Adjust production view to existing views and fix typo in month view.
This commit is contained in:
@@ -30,11 +30,13 @@ if (isset($_POST['action']) && $_POST['action'] == 'set_values') {
|
||||
$local_db->query($query);
|
||||
}
|
||||
|
||||
$dates = build_date_dropdown($local_db, $table_aggregation);
|
||||
$dates = get_month($local_db, $table_aggregation);
|
||||
$chosen_date = (isset($_POST['date'])) ? $_POST['date'] : $dates[0];
|
||||
$production_values = get_production_values_for_month($local_db, $table_aggregation, $chosen_date);
|
||||
$month_production = get_month_production($local_db, $table_production, $chosen_date);
|
||||
|
||||
$chosen_date_time = new DateTime($chosen_date);
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
@@ -43,23 +45,27 @@ $month_production = get_month_production($local_db, $table_production, $chosen_d
|
||||
<link rel="stylesheet" href="/css/layout.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<form style="display: grid; grid-template-columns: 5% 5% 5% 5% 5%; gap: 10px; border-bottom: 1px solid black;" action="/production.php" method="post">
|
||||
<label for="date">Datum</label>
|
||||
<select name="date" id="date" onchange="submit();">
|
||||
<?php
|
||||
foreach ($dates as $date) {
|
||||
$selected = ($date == $chosen_date) ? ' selected="selected"' : '';
|
||||
echo '<option value="' . $date . '"' . $selected . '>' . $date . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<a class="button" href="index.php">Übersicht</a>
|
||||
<form id="date_form" style="align-self: center; width: 500px; display: grid; grid-template-columns: 20% 20% 20% 20% 20%; gap: 10px;" action="/production.php" method="post">
|
||||
<?php
|
||||
if ($dates['first'] < $chosen_date_time) {
|
||||
echo "<button type='button' onclick='submit_form(\"" . $chosen_date_time->modify('-1 month')->format('Y-m') . "\")'><</button>";
|
||||
} else {
|
||||
echo '<span></span>';
|
||||
}
|
||||
echo '<span style="text-align: center">' . $chosen_date_time->modify('+1 month')->format('Y-m') . '</span>';
|
||||
if ($dates['last'] > $chosen_date_time->modify('+1 month')) {
|
||||
echo "<button type='button' onclick='submit_form(\"" . $chosen_date_time->format('Y-m') . "\")'>></button>";
|
||||
} else {
|
||||
echo '<span></span>';
|
||||
}
|
||||
?>
|
||||
<a class="button" href="index.php">Monat</a>
|
||||
<a class="button" href="year.php">Jahr</a>
|
||||
<input type="hidden" name="date" id="date" value=""/>
|
||||
</form>
|
||||
|
||||
<form action="production.php" method="post"
|
||||
style="display: grid; grid-template-columns: 5% 5% 5% 5% 5%; gap: 2px 10px; margin-top: 10px; font-size: 1.3rem;">
|
||||
style="display: grid; grid-template-columns: 15% 12% 10% 10% 12%; gap: 2px 10px; margin-top: 10px; font-size: 1.3rem;">
|
||||
<?php
|
||||
foreach ($production_values as $daily_production) {
|
||||
?>
|
||||
@@ -83,6 +89,12 @@ $month_production = get_month_production($local_db, $table_production, $chosen_d
|
||||
<input type="hidden" name="action" value="set_values"/>
|
||||
<input type="hidden" name="date" value="<?php echo $chosen_date; ?>"/>
|
||||
</form>
|
||||
<script>
|
||||
function submit_form(value) {
|
||||
document.getElementById('date').value = value;
|
||||
document.getElementById('date_form').submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user