Files
omsorg/mitarbeiter-app/pages/fortbildungsantrag.php
T
2026-06-13 20:03:22 +02:00

117 lines
4.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
require_once __DIR__ . '/../lib/auth.php';
require_once __DIR__ . '/../lib/layout.php';
require_login();
$user_id = current_user()['id'];
$materials = db()->query('SELECT * FROM fortbildung_materials ORDER BY sort_order ASC, id ASC')->fetchAll();
$stmt = db()->prepare('SELECT * FROM requests_fortbildungsantrag WHERE user_id = ? ORDER BY created_at DESC');
$stmt->execute([$user_id]);
$requests = $stmt->fetchAll();
$anliegen_labels = [
'wbl_pdl' => 'Anfrage WBL/PDL Weiterbildung',
'fortbildung' => 'Fortbildung anfragen',
'pflichtschulung' => 'Pflichtschulung',
];
$status_labels = ['pending' => 'Ausstehend', 'accepted' => 'Akzeptiert', 'rejected' => 'Abgelehnt'];
layout_start('OMSORG Fortbildungsantrag', 'fortbildungsantrag');
?>
<h1 class="main-title">🎓 Fortbildungs&shy;antrag</h1>
<p class="main-sub">Unterlagen herunterladen und Fortbildungsanträge einreichen.</p>
<?php if (isset($_GET['success'])): ?>
<div class="success" style="margin-top:16px">Antrag erfolgreich eingereicht.</div>
<?php elseif (isset($_GET['error'])): ?>
<div class="error" style="margin-top:16px"><?= e(urldecode($_GET['error'])) ?></div>
<?php endif; ?>
<div class="page-split" style="margin-top:24px">
<div class="page-split-list">
<h2>Unterlagen</h2>
<?php if (empty($materials)): ?>
<p style="color:var(--muted)">Noch keine Unterlagen verfügbar.</p>
<?php else: ?>
<div class="downloads-grid">
<?php foreach ($materials as $m): ?>
<div class="glass download-card">
<h3 class="download-card-title"><?= e($m['title']) ?></h3>
<?php if ($m['description'] !== ''): ?>
<p class="download-card-desc"><?= e($m['description']) ?></p>
<?php endif; ?>
<a href="fortbildung-serve.php?id=<?= (int)$m['id'] ?>" class="btn download-btn">&#8595; Herunterladen</a>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<div class="page-split-form">
<div class="glass detail-card">
<h2>Neuer Antrag</h2>
<form action="../actions/submit-fortbildungsantrag.php" method="post" enctype="multipart/form-data">
<?= csrf_field() ?>
<label>
<span>Anliegen <span style="color:#ff8080">*</span></span>
<select name="anliegen" required>
<option value=""> Bitte wählen </option>
<option value="wbl_pdl">Anfrage WBL/PDL Weiterbildung</option>
<option value="fortbildung">Fortbildung anfragen</option>
<option value="pflichtschulung">Pflichtschulung</option>
</select>
</label>
<label>
<span>Thema <span style="color:#ff8080">*</span></span>
<input type="text" name="thema" required placeholder="z. B. Erste Hilfe, Demenzpflege …">
</label>
<label>
Nachricht
<textarea name="nachricht" rows="4" placeholder="Weitere Informationen oder Wünsche"></textarea>
</label>
<label>
Anhang
<input type="file" name="datei" accept=".pdf,.doc,.docx,.jpg,.jpeg,.png">
<span class="hint">PDF, Word, JPG, PNG &mdash; max. 12 MB (optional)</span>
</label>
<button type="submit" class="btn" style="margin-top:6px">Antrag einreichen</button>
</form>
</div>
</div>
</div>
<?php if (!empty($requests)): ?>
<div style="margin-top:40px">
<h2>Meine Anträge</h2>
<table class="requests-table">
<thead>
<tr>
<th>Anliegen</th>
<th>Thema</th>
<th>Eingereicht</th>
<th>Status</th>
<th>Notiz</th>
</tr>
</thead>
<tbody>
<?php foreach ($requests as $r): ?>
<tr>
<td><?= e($anliegen_labels[$r['anliegen']] ?? $r['anliegen']) ?></td>
<td style="font-weight:800"><?= e($r['thema']) ?></td>
<td style="color:var(--muted);font-size:.9rem"><?= e(date('d.m.Y', strtotime($r['created_at']))) ?></td>
<td><span class="badge badge-<?= e($r['status']) ?>"><?= e($status_labels[$r['status']] ?? $r['status']) ?></span></td>
<td style="color:var(--muted);font-size:.9rem"><?= $r['admin_note'] !== '' ? e($r['admin_note']) : '' ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<?php layout_end(); ?>