add files
This commit is contained in:
1752
admin/aufträge.php
Normal file
1752
admin/aufträge.php
Normal file
File diff suppressed because it is too large
Load Diff
1873
admin/aufträge_dev.php
Normal file
1873
admin/aufträge_dev.php
Normal file
File diff suppressed because it is too large
Load Diff
193
admin/benutzer.php
Normal file
193
admin/benutzer.php
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
$message = "";
|
||||
|
||||
if($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
|
||||
if ( $_POST['passwort'] != $_POST['passwort_wdh']) {
|
||||
$message = "Passwörter Stimmen nicht überein!";
|
||||
}else {
|
||||
if (isset($_POST['aktuelles_passwort'])) {
|
||||
$myusername = mysqli_real_escape_string($db, $_POST['benutzername']);
|
||||
$mypassword = mysqli_real_escape_string($db, $_POST['aktuelles_passwort']);
|
||||
//$mypassword = md5($mypassword);
|
||||
$mypassword = hash_hmac('md5', $mypassword, $secretKey);
|
||||
$sql = "SELECT * FROM admin WHERE username = '$myusername' and passcode = '$mypassword'";
|
||||
$result = mysqli_query($db, $sql);
|
||||
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
|
||||
//$active = $row['active'];
|
||||
|
||||
$count = mysqli_num_rows($result);
|
||||
|
||||
// If result matched $myusername and $mypassword, table row must be 1 row
|
||||
|
||||
if ($count == 1) {
|
||||
|
||||
$mypassword = mysqli_real_escape_string($db, $_POST['passwort']);
|
||||
//$mypassword = md5($mypassword);
|
||||
$mypassword = hash_hmac('md5', $mypassword, $secretKey);
|
||||
$sql = "UPDATE admin SET passcode='$mypassword' WHERE username = '$myusername'";
|
||||
$db->query($sql);
|
||||
|
||||
if (mysqli_error($db)) {
|
||||
$message = "Passwort konnte nicht geändert werden!";
|
||||
} else {
|
||||
$message = "Passwort geändert!";
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$message = "Aktuelles Passwort falsch!";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<link rel="stylesheet" href="css/benutzer.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
</html>
|
||||
|
||||
<body>
|
||||
<div class="benutzer_inhalt">
|
||||
<div class="box_33">
|
||||
<label class="box_label">Passwort Ändern</label>
|
||||
<form action="" method="post">
|
||||
<input class="input" hidden autocomplete="benutzername" type="text" name="benutzername">
|
||||
<input class="box_input" autocomplete="aktuelles_passwort" placeholder="Aktuelles Passwort" type="password" name="aktuelles_passwort">
|
||||
<input class="box_input" autocomplete="neues_passwort" placeholder="Neues Passwort" type="password" name="passwort">
|
||||
<input class="box_input" autocomplete="neues_passwort_wdh" placeholder="Neues Passwort Wdh." type="password" name="passwort_wdh">
|
||||
<input class="button" style="display: block; margin:auto" type="submit" value="Ändern"/>
|
||||
<div class="error"><?php echo $message; ?></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
var name = $('.menu_account').data('name');
|
||||
$('.box_label').text('Passwort Ändern '+name);
|
||||
$('.input[name="benutzername"]').val(name)
|
||||
|
||||
|
||||
$('.kunde_aendern').click(function () {
|
||||
$('.help-block').remove();
|
||||
|
||||
if ($('#account_passwort').val() != "") {
|
||||
if ($('#account_new_passwort1').val() != "") {
|
||||
if ($('#account_new_passwort1').val() == $('#account_new_passwort2').val()) {
|
||||
console.log('bv');
|
||||
var formData = {
|
||||
passwort: $('#account_passwort').val(),
|
||||
benutzer: document.getElementById('account_caption').innerText,
|
||||
passwort1: $('#account_new_passwort1').val(),
|
||||
};
|
||||
$.ajax({
|
||||
url: '/db/passwort_aenderung.php',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
dataType: "json",
|
||||
encode: true,
|
||||
}).done(function (data) {
|
||||
console.log(data);
|
||||
if (data['success'] == false) {
|
||||
|
||||
if (data.errors.passwort) {
|
||||
$("#account_form").append(
|
||||
'<div class="help-block">' + data.errors.passwort + '</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (data['success'] == true) {
|
||||
document.getElementById('account_form').style.display = 'none';
|
||||
document.getElementById('account_success').style.display = 'block';
|
||||
setTimeout(
|
||||
function()
|
||||
{
|
||||
$(".account").hide();
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#account_form").append(
|
||||
'<div class="help-block">Passwörter stimmen nicht überein!</div>'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$("#account_form").append(
|
||||
'<div class="help-block">Bitte Neue Passwörter eingeben!</div>'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$("#account_form").append(
|
||||
'<div class="help-block">Bitte aktuelles Passwort eingeben!</div>'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
$('.account_close').click( function () {
|
||||
$('.account').hide();
|
||||
})
|
||||
|
||||
function aendern() {
|
||||
|
||||
if ($('#account_new_passwort1').val() == $('#account_new_passwort2').val()) {
|
||||
var formData = {
|
||||
passwort1: $('#account_passwort').val(),
|
||||
benutzer1: document.getElementById('account_caption').innerText,
|
||||
};
|
||||
$.ajax({
|
||||
url: '/db/passwort_aenderung.php',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
dataType: "json",
|
||||
encode: true,
|
||||
}).done(function (data) {
|
||||
console.log(data);
|
||||
console.log("bla");
|
||||
if (data['success_'] == false) {
|
||||
|
||||
if (data.errors.passwort) {
|
||||
$("#account_form").append(
|
||||
'<div class="help-block">' + data.errors.passwort + '</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (data['success_'] == true) {
|
||||
|
||||
document.getElementById('account_form_form').style.display = 'none';
|
||||
document.getElementById('account_success').style.display = 'block';
|
||||
setTimeout(
|
||||
function()
|
||||
{
|
||||
$(".bearbeiten").hide();
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}else {
|
||||
$("#account_form").append(
|
||||
'<div class="help-block">Passwörter stimmen nicht überein!</div>'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
240
admin/kalender.php
Normal file
240
admin/kalender.php
Normal file
@@ -0,0 +1,240 @@
|
||||
<html>
|
||||
|
||||
<link rel="stylesheet" href="css/kalender.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
</html>
|
||||
<div class="aktuelles_datum">Aktuelles Datum: <?php echo date("d/m/Y") ?></div>
|
||||
|
||||
<!-- Kalender Navigation Button -->
|
||||
<div style="display: flex; justify-content: center;">
|
||||
<button id="prev-month"><</button>
|
||||
<div id="aktueller-monat" style="width: 75px; text-align: center;"></div> <!-- feld für aktuellen monat -->
|
||||
<button id="next-month">></button>
|
||||
<div id="current-month-year"></div> <!-- Feld für Aktuellen Monat und Jahr -->
|
||||
<button id="prev-year" style="margin-left: 10px"><</button>
|
||||
<input type="number" id="year" value="<?php echo date('Y'); ?>" style="width: 75px; margin-left: 10px; margin-right: 10px; text-align: center;">
|
||||
<button id="next-year">></button>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div id="calendar" style="width: 100%; margin: auto;"></div>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
$sql = "SELECT * FROM aufträge ORDER BY auftrag_ende";
|
||||
$result = mysqli_query($db,$sql);
|
||||
|
||||
$test_array = [];
|
||||
$array_i = 0;
|
||||
while($row = mysqli_fetch_assoc($result)) {
|
||||
|
||||
$array_i++;
|
||||
|
||||
$test_array[$array_i]['beginn'] = $row['auftrag_beginn'];
|
||||
$test_array[$array_i]['ende'] = $row['auftrag_ende'];
|
||||
$test_array[$array_i]['name'] = $row['auftragname'];
|
||||
$test_array[$array_i]['id'] = $row['id'];
|
||||
|
||||
|
||||
}
|
||||
$json = json_encode($test_array, JSON_PRETTY_PRINT);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<script>
|
||||
function kalenderErstellen(year, month) {
|
||||
// Get the current date to determine the first day of the month
|
||||
var firstDay = new Date(year, month - 1, 1);
|
||||
var startingDay = firstDay.getDay();
|
||||
if (startingDay === 0) {
|
||||
startingDay = 6; // Adjust Sunday to be the last day of the week
|
||||
} else {
|
||||
startingDay -= 1; // Adjust the starting day for Monday first
|
||||
}
|
||||
|
||||
// Get the number of days in the selected month
|
||||
var daysInMonth = new Date(year, month, 0).getDate();
|
||||
|
||||
// Create an array to store the calendar table rows
|
||||
var calendarRows = [];
|
||||
|
||||
// Start from the first day of the month and go until the last day
|
||||
var dayCount = 1;
|
||||
for (var i = 0; i < 6; i++) {
|
||||
var calendarRow = [];
|
||||
|
||||
// Fill in the days of the month
|
||||
for (var j = 0; j < 7; j++) {
|
||||
if (dayCount > daysInMonth) {
|
||||
break;
|
||||
}
|
||||
if (i === 0 && j < startingDay) {
|
||||
calendarRow.push('');
|
||||
} else {
|
||||
calendarRow.push(dayCount);
|
||||
dayCount++;
|
||||
}
|
||||
}
|
||||
|
||||
calendarRows.push(calendarRow);
|
||||
|
||||
// If we have reached the end of the month, stop generating rows
|
||||
if (dayCount > daysInMonth) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Create the calendar table
|
||||
var table = '<table>';
|
||||
table += '<colgroup><col style="width: 14%;"><col style="width: 14%;"><col style="width: 14%;"><col style="width: 14%;"><col style="width: 14%;"><col style="width: 14%;"><col style="width: 14%;"></colgroup>'
|
||||
table += '<tr><th>Montag</th><th>Dienstag</th><th>Mittwoch</th><th>Donnerstag</th><th>Freitag</th><th>Samstag</th><th>Sonntag</th></tr>';
|
||||
for (var i = 0; i < calendarRows.length; i++) {
|
||||
table += '<tr>';
|
||||
for (var j = 0; j < calendarRows[i].length; j++) {
|
||||
var day = calendarRows[i][j];
|
||||
table += '<td><div style="width: 100%; border-bottom: 1px solid black; min-height: 20px">' + (day !== '' ? day : '') + '</div><div style="width: 100%; min-height: 100px;" class="' + (day.toString().padStart(2, '0') !== '' ? day.toString().padStart(2, '0') : '') + '-' + month.toString().padStart(2, '0') + '-' + year +'"></div></td>';
|
||||
}
|
||||
table += '</tr>';
|
||||
}
|
||||
table += '</table>';
|
||||
|
||||
// Display the calendar on the page
|
||||
document.getElementById('calendar').innerHTML = table;
|
||||
|
||||
// Display the current month and year
|
||||
var monthNames = ['Janurar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'];
|
||||
document.getElementById('aktueller-monat').innerText = monthNames[month - 1];
|
||||
document.getElementById('year').value = year;
|
||||
}
|
||||
|
||||
// Get the current year and month from PHP
|
||||
var currentYear = <?php echo date('Y'); ?>;
|
||||
var currentMonth = <?php echo date('n'); ?>;
|
||||
|
||||
// Function to update the calendar based on the selected year and month
|
||||
function updateCalendar() {
|
||||
kalenderErstellen(currentYear, currentMonth);
|
||||
datenEintrag();
|
||||
}
|
||||
|
||||
updateCalendar();
|
||||
|
||||
// Event listener for the previous month button
|
||||
document.getElementById('prev-month').addEventListener('click', function() {
|
||||
currentMonth--;
|
||||
if (currentMonth < 1) {
|
||||
currentMonth = 12;
|
||||
currentYear--;
|
||||
}
|
||||
updateCalendar();
|
||||
});
|
||||
|
||||
// Event listener for the next month button
|
||||
document.getElementById('next-month').addEventListener('click', function() {
|
||||
currentMonth++;
|
||||
if (currentMonth > 12) {
|
||||
currentMonth = 1;
|
||||
currentYear++;
|
||||
}
|
||||
updateCalendar();
|
||||
});
|
||||
|
||||
// Event listener for the previous year button
|
||||
document.getElementById('prev-year').addEventListener('click', function() {
|
||||
currentYear--;
|
||||
updateCalendar();
|
||||
});
|
||||
|
||||
// Event listener for the next year button
|
||||
document.getElementById('next-year').addEventListener('click', function() {
|
||||
currentYear++;
|
||||
updateCalendar();
|
||||
});
|
||||
|
||||
// Event listener for year input change
|
||||
document.getElementById('year').addEventListener('change', function() {
|
||||
currentYear = parseInt(this.value);
|
||||
updateCalendar();
|
||||
});
|
||||
|
||||
var farbe = "";
|
||||
|
||||
function zufallsfarbe() {
|
||||
|
||||
var back = ["lightblue","gray",'yellow','red','purple','aqua','bisque', 'brown', 'chocolate', 'hotpink'];
|
||||
var rand = back[Math.floor(Math.random() * back.length)];
|
||||
while (rand == farbe){
|
||||
rand = back[Math.floor(Math.random() * back.length)];
|
||||
|
||||
}
|
||||
|
||||
|
||||
return rand;
|
||||
|
||||
};
|
||||
|
||||
|
||||
function datenEintrag() {
|
||||
|
||||
var json = <?php echo $json?>;
|
||||
|
||||
$.each(json, function(key, value) {
|
||||
|
||||
farbe = zufallsfarbe();
|
||||
|
||||
var beginn_split = json[key].beginn.split('-')
|
||||
var ende_split = json[key].ende.split('-')
|
||||
|
||||
var i = 1;
|
||||
|
||||
if (ende_split[2] == beginn_split[2]) {
|
||||
|
||||
$('.'+beginn_split[2]+'-'+beginn_split[1]+'-'+beginn_split[0]).append('<a href="?seite=aufträge&id='+json[key].id+'"><div style="width: 100%; background-color: '+farbe+';">'+json[key].name+'</div></a>');
|
||||
|
||||
}else {
|
||||
|
||||
|
||||
|
||||
var startYear = parseInt(beginn_split[0]);
|
||||
var startMonth = parseInt(beginn_split[1]);
|
||||
var startDay = parseInt(beginn_split[2]);
|
||||
|
||||
var endYear = parseInt(ende_split[0]);
|
||||
var endMonth = parseInt(ende_split[1]);
|
||||
var endDay = parseInt(ende_split[2]);
|
||||
var currentDate = new Date(startYear, startMonth - 1, startDay);
|
||||
|
||||
|
||||
while (currentDate <= new Date(endYear, endMonth - 1, endDay)) {
|
||||
var currentDay = currentDate.getDate().toString().padStart(2, '0');
|
||||
var currentMonth = (currentDate.getMonth() + 1).toString().padStart(2, '0'); // Month is 0-indexed in JavaScript
|
||||
var currentYear = currentDate.getFullYear();
|
||||
|
||||
var selector = '.'+ currentDay + '-' + currentMonth + '-' + currentYear;
|
||||
|
||||
if (selector == "") {
|
||||
break;
|
||||
}
|
||||
|
||||
$(selector).append('<a href="?seite=aufträge&id=' + json[key].id + '"><div style="width: 100%; background-color: ' + farbe + ';">' + json[key].name + '</div></a>');
|
||||
|
||||
currentDate.setDate(currentDate.getDate() + 1); // Move to the next day
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
//Aktuellen Tag Hervorheben
|
||||
var currentDay = <?php echo date('d'); ?>;
|
||||
var currentYear = <?php echo date('Y'); ?>;
|
||||
var currentMonth = <?php echo date('n'); ?>;
|
||||
$('.'+ currentDay.toString().padStart(2, '0') + '-' + currentMonth.toString().padStart(2, '0') + '-' + currentYear).parent().css('background-color', 'lightgrey');
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
1401
admin/kunden.php
Normal file
1401
admin/kunden.php
Normal file
File diff suppressed because it is too large
Load Diff
193
admin/privat.php
Normal file
193
admin/privat.php
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
$message = "";
|
||||
|
||||
if($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
|
||||
if ( $_POST['passwort'] != $_POST['passwort_wdh']) {
|
||||
$message = "Passwörter Stimmen nicht überein!";
|
||||
}else {
|
||||
if (isset($_POST['aktuelles_passwort'])) {
|
||||
$myusername = mysqli_real_escape_string($db, $_POST['benutzername']);
|
||||
$mypassword = mysqli_real_escape_string($db, $_POST['aktuelles_passwort']);
|
||||
//$mypassword = md5($mypassword);
|
||||
$mypassword = hash_hmac('md5', $mypassword, $secretKey);
|
||||
$sql = "SELECT * FROM admin WHERE username = '$myusername' and passcode = '$mypassword'";
|
||||
$result = mysqli_query($db, $sql);
|
||||
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
|
||||
//$active = $row['active'];
|
||||
|
||||
$count = mysqli_num_rows($result);
|
||||
|
||||
// If result matched $myusername and $mypassword, table row must be 1 row
|
||||
|
||||
if ($count == 1) {
|
||||
|
||||
$mypassword = mysqli_real_escape_string($db, $_POST['passwort']);
|
||||
//$mypassword = md5($mypassword);
|
||||
$mypassword = hash_hmac('md5', $mypassword, $secretKey);
|
||||
$sql = "UPDATE admin SET passcode='$mypassword' WHERE username = '$myusername'";
|
||||
$db->query($sql);
|
||||
|
||||
if (mysqli_error($db)) {
|
||||
$message = "Passwort konnte nicht geändert werden!";
|
||||
} else {
|
||||
$message = "Passwort geändert!";
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$message = "Aktuelles Passwort falsch!";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<link rel="stylesheet" href="css/benutzer.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
</html>
|
||||
|
||||
<body>
|
||||
<div class="benutzer_inhalt">
|
||||
<div class="box_33">
|
||||
<label class="box_label">Passwort Ändern</label>
|
||||
<form action="" method="post">
|
||||
<input class="input" hidden autocomplete="benutzername" type="text" name="benutzername">
|
||||
<input class="box_input" autocomplete="aktuelles_passwort" placeholder="Aktuelles Passwort" type="password" name="aktuelles_passwort">
|
||||
<input class="box_input" autocomplete="neues_passwort" placeholder="Neues Passwort" type="password" name="passwort">
|
||||
<input class="box_input" autocomplete="neues_passwort_wdh" placeholder="Neues Passwort Wdh." type="password" name="passwort_wdh">
|
||||
<input class="button" style="display: block; margin:auto" type="submit" value="Ändern"/>
|
||||
<div class="error"><?php echo $message; ?></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
var name = $('.menu_account').data('name');
|
||||
$('.box_label').text('Passwort Ändern '+name);
|
||||
$('.input[name="benutzername"]').val(name)
|
||||
|
||||
|
||||
$('.kunde_aendern').click(function () {
|
||||
$('.help-block').remove();
|
||||
|
||||
if ($('#account_passwort').val() != "") {
|
||||
if ($('#account_new_passwort1').val() != "") {
|
||||
if ($('#account_new_passwort1').val() == $('#account_new_passwort2').val()) {
|
||||
console.log('bv');
|
||||
var formData = {
|
||||
passwort: $('#account_passwort').val(),
|
||||
benutzer: document.getElementById('account_caption').innerText,
|
||||
passwort1: $('#account_new_passwort1').val(),
|
||||
};
|
||||
$.ajax({
|
||||
url: '/db/passwort_aenderung.php',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
dataType: "json",
|
||||
encode: true,
|
||||
}).done(function (data) {
|
||||
console.log(data);
|
||||
if (data['success'] == false) {
|
||||
|
||||
if (data.errors.passwort) {
|
||||
$("#account_form").append(
|
||||
'<div class="help-block">' + data.errors.passwort + '</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (data['success'] == true) {
|
||||
document.getElementById('account_form').style.display = 'none';
|
||||
document.getElementById('account_success').style.display = 'block';
|
||||
setTimeout(
|
||||
function()
|
||||
{
|
||||
$(".account").hide();
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#account_form").append(
|
||||
'<div class="help-block">Passwörter stimmen nicht überein!</div>'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$("#account_form").append(
|
||||
'<div class="help-block">Bitte Neue Passwörter eingeben!</div>'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$("#account_form").append(
|
||||
'<div class="help-block">Bitte aktuelles Passwort eingeben!</div>'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
$('.account_close').click( function () {
|
||||
$('.account').hide();
|
||||
})
|
||||
|
||||
function aendern() {
|
||||
|
||||
if ($('#account_new_passwort1').val() == $('#account_new_passwort2').val()) {
|
||||
var formData = {
|
||||
passwort1: $('#account_passwort').val(),
|
||||
benutzer1: document.getElementById('account_caption').innerText,
|
||||
};
|
||||
$.ajax({
|
||||
url: '/db/passwort_aenderung.php',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
dataType: "json",
|
||||
encode: true,
|
||||
}).done(function (data) {
|
||||
console.log(data);
|
||||
console.log("bla");
|
||||
if (data['success_'] == false) {
|
||||
|
||||
if (data.errors.passwort) {
|
||||
$("#account_form").append(
|
||||
'<div class="help-block">' + data.errors.passwort + '</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (data['success_'] == true) {
|
||||
|
||||
document.getElementById('account_form_form').style.display = 'none';
|
||||
document.getElementById('account_success').style.display = 'block';
|
||||
setTimeout(
|
||||
function()
|
||||
{
|
||||
$(".bearbeiten").hide();
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}else {
|
||||
$("#account_form").append(
|
||||
'<div class="help-block">Passwörter stimmen nicht überein!</div>'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
83
admin/startseite.php
Normal file
83
admin/startseite.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<html>
|
||||
<link rel="stylesheet" href="css/startseite.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
$sql = "SELECT * FROM aufträge";
|
||||
$result = mysqli_query($db, $sql);
|
||||
|
||||
// Ein Array, um die Ergebnisse nach Jahren zu gruppieren
|
||||
$yearlyStats = array();
|
||||
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$year = date('Y', strtotime($row['auftrag_beginn'])); // Extrahiere das Jahr aus dem Datum
|
||||
|
||||
// Initialisiere die Daten für das Jahr, falls noch nicht vorhanden
|
||||
if (!isset($yearlyStats[$year])) {
|
||||
$yearlyStats[$year] = array(
|
||||
'offeneAufträge' => 0,
|
||||
'beendeteAufträge' => 0,
|
||||
'umsatz' => 0,
|
||||
'gewinn' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
// Zähle die offenen und beendeten Aufträge pro Jahr
|
||||
if ($row['beendet'] == '1') {
|
||||
$yearlyStats[$year]['beendeteAufträge']++;
|
||||
} else {
|
||||
$yearlyStats[$year]['offeneAufträge']++;
|
||||
}
|
||||
|
||||
// Berechne den Umsatz und Gewinn pro Jahr
|
||||
$json = json_decode($row['materialien'], true);
|
||||
$preis = $row['preis'];
|
||||
|
||||
$materialienSum = 0; // Summiere die Materialien für jeden Auftrag
|
||||
foreach ($json as $key => $value) {
|
||||
$split = explode(":", $value);
|
||||
$materialienSum += str_replace(',', '.', $split[1]);
|
||||
}
|
||||
|
||||
$yearlyStats[$year]['umsatz'] += $preis; // Akkumuliere den Umsatz für das Jahr
|
||||
$yearlyStats[$year]['gewinn'] += ($preis - $materialienSum); // Akkumuliere den Gewinn für das Jahr
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
//array in umgekehrter rheinfolge sortieren
|
||||
krsort($yearlyStats);
|
||||
|
||||
foreach ($yearlyStats as $year => $stats) {
|
||||
?>
|
||||
<table style="margin-top: 20px;">
|
||||
<caption>Statistiken <?php echo $year; ?></caption>
|
||||
<colgroup>
|
||||
<col style="width: 25%;">
|
||||
<col style="width: 25%;">
|
||||
<col style="width: 25%;">
|
||||
<col style="width: 25%;">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Offene Aufträge</th>
|
||||
<th>Beendete Aufträge</th>
|
||||
<th>Gewinn</th>
|
||||
<th>Umsatz</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $stats['offeneAufträge']; ?></td>
|
||||
<td><?php echo $stats['beendeteAufträge']; ?></td>
|
||||
<td><?php echo number_format($stats['gewinn'], 2) . " €"; ?></td>
|
||||
<td><?php echo number_format($stats['umsatz'], 2) . " €"; ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
110
admin/startseite_dev.php
Normal file
110
admin/startseite_dev.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Statistiken</title>
|
||||
<!-- Google Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
|
||||
<!-- Tailwind CSS -->
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
background-color: #f3f4f6;
|
||||
color: #111827;
|
||||
}
|
||||
.card {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
||||
}
|
||||
.card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.table-header {
|
||||
background-color: #1f2937;
|
||||
color: white;
|
||||
}
|
||||
.highlight {
|
||||
color: #10b981; /* Gr<47>n f<>r Gewinn */
|
||||
font-weight: 500;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container mx-auto px-4 py-8">
|
||||
<h1 class="text-3xl font-bold text-center mb-8 text-gray-800">Auftragsstatistiken</h1>
|
||||
|
||||
<?php
|
||||
mysqli_set_charset($db, "utf8mb4");
|
||||
|
||||
$sql = "SELECT * FROM aufträge";
|
||||
$result = mysqli_query($db, $sql);
|
||||
|
||||
$yearlyStats = array();
|
||||
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$year = date('Y', strtotime($row['auftrag_beginn']));
|
||||
|
||||
if (!isset($yearlyStats[$year])) {
|
||||
$yearlyStats[$year] = array(
|
||||
'offeneAuftr<74>ge' => 0,
|
||||
'beendeteAuftr<74>ge' => 0,
|
||||
'umsatz' => 0,
|
||||
'gewinn' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
if ($row['beendet'] == '1') {
|
||||
$yearlyStats[$year]['beendeteAuftr<74>ge']++;
|
||||
} else {
|
||||
$yearlyStats[$year]['offeneAuftr<74>ge']++;
|
||||
}
|
||||
|
||||
$json = json_decode($row['materialien'], true);
|
||||
$preis = $row['preis'];
|
||||
|
||||
$materialienSum = 0;
|
||||
foreach ($json as $key => $value) {
|
||||
$split = explode(":", $value);
|
||||
$materialienSum += str_replace(',', '.', $split[1]);
|
||||
}
|
||||
|
||||
$yearlyStats[$year]['umsatz'] += $preis;
|
||||
$yearlyStats[$year]['gewinn'] += ($preis - $materialienSum);
|
||||
}
|
||||
|
||||
krsort($yearlyStats);
|
||||
|
||||
foreach ($yearlyStats as $year => $stats) {
|
||||
?>
|
||||
<div class="card p-6 mb-6">
|
||||
<h2 class="text-xl font-bold text-gray-700 mb-4">Statistiken f<>r <span class="text-indigo-600"><?php echo $year; ?></span></h2>
|
||||
<table class="w-full text-left border-collapse">
|
||||
<thead class="table-header">
|
||||
<tr>
|
||||
<th class="p-3">Offene Auftr<74>ge</th>
|
||||
<th class="p-3">Beendete Auftr<74>ge</th>
|
||||
<th class="p-3">Gewinn</th>
|
||||
<th class="p-3">Umsatz</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="bg-gray-50 hover:bg-gray-100">
|
||||
<td class="p-3"><?php echo $stats['offeneAuftr<74>ge']; ?></td>
|
||||
<td class="p-3"><?php echo $stats['beendeteAuftr<74>ge']; ?></td>
|
||||
<td class="p-3 highlight"><?php echo number_format($stats['gewinn'], 2) . " <20>"; ?></td>
|
||||
<td class="p-3"><?php echo number_format($stats['umsatz'], 2) . " <20>"; ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user