Files
thetool/Layout/default/TimerecordingPermit/Index.php
2024-02-04 11:49:57 +01:00

195 lines
8.7 KiB
PHP

<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
$daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
?>
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<style>
.edit-button {
color: #007bff;
cursor: pointer;
}
.approved-open {
background-color: #fdb751 !important;
color: #000;
border-radius: 5px;
}
.approved-closed {
background-color: #96ff68 !important;
color: #000;
border-radius: 5px;
padding-top: 2px;
}
.fa-clock {
color: #ff9b00;
font-size: 15px;
}
.edit-placeholder {
height: 15px;
width: 22px;
display: inline-block;
}
.fa-square-check {
color: #23b900;
font-size: 17px;
vertical-align: middle;
margin-bottom: 2px;
margin-right: 3px;
}
</style>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item active">Buchungen</li>
</ol>
</div>
<h4 class="page-title">Buchungen</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="card">
<div class="card-body mb-3">
<div class="row">
<div class="col-12">
<div class="float-left">
<h4 class="header-title">Liste aller Buchungen</h4>
</div>
</div>
</div>
<table id="datatable" class="table table-hover table-sm">
<thead>
<tr>
<th style="width: 200px;" class="text-center text-nowrap ">Datum</th>
<th style="width: 200px;" class="text-nowrap">Mitarbeiter</th>
<th class="text-nowrap text-center edit-width">Von</th>
<th class="text-nowrap text-center edit-width">Bis</th>
<th class="text-nowrap edit-width text-center">Summe</th>
<th class="text-center text-nowrap">Buchungsart</th>
<th class="text-center">Anmerkung</th>
<th class="text-center edit-width-large">Freigabe</th>
<th class="edit-width text-center"></th>
</tr>
<tr id="filterrow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($timerecordings as $timerecording):
$state = "";
$enddate = "";
$sum = "-";
$day = "";
$orderdate = $timerecording->start;
if ($timerecording->timerecordingCategory->hourday == 1) {
$date = date("d.m.Y", $timerecording->start);
$datadate = date("Y-m-d", $timerecording->start);
$start = date("H:i", $timerecording->start);
$end = date("H:i", $timerecording->end);
$seconds = $timerecording->end - $timerecording->start;
$minutes = floor(($seconds % 3600) / 60);
$hours = floor($seconds / 3600);
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
$day = $daysgerm[date("w", $timerecording->start)];
} else if ($timerecording->timerecordingCategory->hourday == 2) {
$date = date("d.m.", $timerecording->start) . " - " . $daysgerm[date("w", $timerecording->end)] . " " . date("d.m.Y", $timerecording->end);
$datadate = date("Y-m-d", $timerecording->start);
$enddate = date("Y-m-d", $timerecording->end);
$start = "-";
$end = "-";
$day = $daysgerm[date("w", $timerecording->start)];
} else if ($timerecording->timerecordingCategory->hourday == 3 || $timerecording->timerecordingCategory->hourday == 4) {
$date = date("d.m.Y", $timerecording->start);
$datadate = date("Y-m-d", $timerecording->start);
$start = "-";
$end = "-";
$day = $daysgerm[date("w", $timerecording->start)];
}
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {
$state = '<i class="fa-regular fa-clock mr-1"></i>';
} else if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 1) {
$state = '<i class="fa-regular fa-circle-check mr-1"></i>';
}
$approved = 'Offen';
if ($timerecording->approved == 1) $approved = 'Genehmigt';
$completed = 'Genehmigt';
// if ($timerecording->completed == 1) $completed = 'Genehmigt';
?>
<tr class="">
<td data-order="<?= $orderdate ?>"
class="text-nowrap "><?= $state ?><?= $day . " " . $date ?></td>
<td class="text-nowrap "><?= $timerecording->user->name ?></td>
<td class="text-nowrap text-center"><?= $start ?></td>
<td class="text-nowrap text-center"><?= $end ?></td>
<td class="text-nowrap text-center"><?= $sum ?></td>
<td class="text-nowrap"><?= $timerecording->timerecordingCategory->name ?></td>
<td><?= $timerecording->comment ?></td>
<td class="text-center"><?= $approved ?></td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<?php if ($timerecording->completed == 0):
if ($timerecording->approved == 0) : ?>
<a href="<?= self::getUrl("TimerecordingPermit", "approve", ["id" => $timerecording->id]) ?>"
onclick="if(!confirm('Buchung genehmigen?')) return false;"> <i
class="fa-regular fa-square-check permit-button" title="genehmigen"
data-id="<?= $timerecording->id ?>"></i></a>
<a href="<?= self::getUrl("TimerecordingPermit", "deny", ["id" => $timerecording->id]) ?>"
onclick="if(!confirm('Buchung wirklich ablehnen?')) return false;"> <i
class="fas fa-ban deny-button" title="genehmigen"
data-id="<?= $timerecording->id ?>"></i></a>
<?php else : ?>
<div class="edit-placeholder"></div>
<?php endif; ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var hidesearch = [2, 3, 4, 8];
var columnfilter = [7];
var columnoptions = '<option value=""></option><option value="Offen">Offen</option><option value="Genehmigt">Genehmigt</option><option value="Abgelehnt">Abgelehnt</option>';
$(document).ready(function () {
});
</script>
<script type="text/javascript"
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>