feat: added adminpanel with overview; added holiday page with functionality; added payout page + functionality; added notification Feature
This commit is contained in:
43
holiday.php
Normal file
43
holiday.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
session_start();
|
||||
require 'config.php';
|
||||
require 'db.php';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$userId = $_SESSION['user']['id'];
|
||||
$von = $_POST['von'];
|
||||
$bis = $_POST['bis'];
|
||||
$grund = $dbhandle->real_escape_string($_POST['grund']);
|
||||
|
||||
// Urlaub eintragen
|
||||
$stmt = $dbhandle->prepare("INSERT INTO urlaub (user_id, von, bis, grund) VALUES (?, ?, ?, ?)");
|
||||
$stmt->bind_param("isss", $userId, $von, $bis, $grund);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
|
||||
// Benachrichtigung für Admins
|
||||
$message = "hat einen Urlaubsantrag gestellt: {$von} bis {$bis}.";
|
||||
$notif = $dbhandle->prepare("INSERT INTO notifications (user_id, message, type) VALUES (?, ?, 'urlaub')");
|
||||
$notif->bind_param("is", $userId, $message);
|
||||
$notif->execute();
|
||||
$notif->close();
|
||||
|
||||
echo "✅ Urlaub beantragt!";
|
||||
}
|
||||
?>
|
||||
<?php require "header.php"?>
|
||||
<head>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<form method="post">
|
||||
<label>Von:</label>
|
||||
<input type="date" name="von" required>
|
||||
<label>Bis:</label>
|
||||
<input type="date" name="bis" required>
|
||||
<label>Grund:</label>
|
||||
<textarea name="grund"></textarea>
|
||||
<button type="submit">Urlaub beantragen</button>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
Reference in New Issue
Block a user