Files
Felix KemmlerandClaude Sonnet 5 b6c1389c55 Reorganize into monorepo layout, move mitarbeiter-app to legacy reference
Consolidates the previously separate omsorgapp and omsorgCore repos
(each had their own nested .git with GitHub history) plus the old
root-level website/mitarbeiter-app into a single monorepo, matching
the structure already documented in the root CLAUDE.md. Also moves
the PHP employee app aside as omsorgWeb/mitarbeiter-app-legacy/ to
serve as a template for a ground-up rewrite.

Fixes .gitignore in the same pass: the config-secrets/uploads/data
patterns were unanchored (relative to repo root, not depth-agnostic),
so they silently stopped matching once the app moved under omsorgWeb/.
Patterns are now **/-prefixed and cover both mitarbeiter-app and
mitarbeiter-app-legacy, keeping DB/SMTP credentials and uploaded
employee documents out of version control.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-07 14:21:37 +02:00

111 lines
4.2 KiB
PHP
Raw Permalink 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'];
$admin = is_admin();
if ($admin) {
$docs = db()->query(
'SELECT d.*, u.name AS user_name
FROM dokumente d
JOIN users u ON u.id = d.user_id
ORDER BY d.created_at DESC'
)->fetchAll();
} else {
$stmt = db()->prepare('SELECT * FROM dokumente WHERE user_id = ? ORDER BY created_at DESC');
$stmt->execute([$user_id]);
$docs = $stmt->fetchAll();
}
layout_start('OMSORG Dokumentenarchiv', 'dokumentenarchiv');
?>
<h1 class="main-title">🗂 Dokumenten&shy;archiv</h1>
<p class="main-sub">Eigene Nachweise und Dokumente hochladen und verwalten.</p>
<?php if (isset($_GET['ok'])): ?>
<div class="success" style="margin-top:16px">Dokument erfolgreich hochgeladen.</div>
<?php elseif (isset($_GET['deleted'])): ?>
<div class="success" style="margin-top:16px">Dokument wurde gelöscht.</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><?= $admin ? 'Alle Dokumente' : 'Meine Dokumente' ?></h2>
<?php if (empty($docs)): ?>
<p style="color:var(--muted)">Noch keine Dokumente vorhanden.</p>
<?php else: ?>
<table class="requests-table">
<thead>
<tr>
<?php if ($admin): ?><th>Mitarbeiter</th><?php endif; ?>
<th>Kategorie</th>
<th>Beschreibung</th>
<th>Datei</th>
<th>Hochgeladen</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($docs as $d): ?>
<tr>
<?php if ($admin): ?>
<td style="font-weight:800"><?= e($d['user_name']) ?></td>
<?php endif; ?>
<td><?= e($d['kategorie']) ?></td>
<td style="color:var(--muted);font-size:.9rem"><?= $d['beschreibung'] !== '' ? e($d['beschreibung']) : '' ?></td>
<td>
<a href="dokument-serve.php?id=<?= (int)$d['id'] ?>" class="btn download-btn" style="padding:6px 14px;font-size:.85rem">&#8595; <?= e($d['original_name']) ?></a>
</td>
<td style="color:var(--muted);font-size:.9rem"><?= e(date('d.m.Y', strtotime($d['created_at']))) ?></td>
<td>
<form method="post" action="../actions/delete-dokument.php" onsubmit="return confirm('Dokument wirklich löschen?')">
<?= csrf_field() ?>
<input type="hidden" name="id" value="<?= (int)$d['id'] ?>">
<button type="submit" class="btn" style="background:rgba(220,50,50,.25);padding:6px 14px;font-size:.85rem">Löschen</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<div class="page-split-form">
<div class="glass detail-card">
<h2>Dokument hochladen</h2>
<form action="../actions/upload-dokument.php" method="post" enctype="multipart/form-data">
<?= csrf_field() ?>
<label>
<span>Kategorie <span style="color:#ff8080">*</span></span>
<select name="kategorie" required>
<option value=""> Bitte wählen </option>
<option value="Fortbildungsnachweis">Fortbildungsnachweis</option>
<option value="Zeugnis">Zeugnis</option>
<option value="Bescheinigung">Bescheinigung</option>
<option value="Sonstiges">Sonstiges</option>
</select>
</label>
<label>
Beschreibung
<input type="text" name="beschreibung" placeholder="z. B. Erste-Hilfe-Kurs 2025">
</label>
<label>
<span>Datei <span style="color:#ff8080">*</span></span>
<input type="file" name="datei" accept=".pdf,.doc,.docx,.jpg,.jpeg,.png" required>
<span class="hint">PDF, Word, JPG, PNG &mdash; max. 12 MB</span>
</label>
<button type="submit" class="btn" style="margin-top:6px">Hochladen</button>
</form>
</div>
</div>
</div>
<?php layout_end(); ?>