Zeiterfassung Anpassungen
This commit is contained in:
@@ -1,5 +1,35 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
||||
$daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
$monthger[1] = "Jänner";
|
||||
$monthger[2] = "Februar";
|
||||
$monthger[3] = "März";
|
||||
$monthger[4] = "April";
|
||||
$monthger[5] = "Mai";
|
||||
$monthger[6] = "Juni";
|
||||
$monthger[7] = "Juli";
|
||||
$monthger[8] = "August";
|
||||
$monthger[9] = "September";
|
||||
$monthger[10] = "Oktober";
|
||||
$monthger[11] = "November";
|
||||
$monthger[12] = "Dezember";
|
||||
$time = time();
|
||||
|
||||
for ($i = 1; $i <= 25; $i++) {
|
||||
$kw = date('W', $time);
|
||||
$year = date('Y', $time);
|
||||
$timestamp_montag = strtotime("{$year}-W{$kw}");
|
||||
$timestamp_freitag = strtotime("{$year}-W{$kw}-5");
|
||||
|
||||
$weeks[$time] = "KW" . $kw . " " . $year . " (" . date('d.m', $timestamp_montag) . "-" . date('d.m', $timestamp_freitag) . ")";
|
||||
$time = $time - 604800;
|
||||
}
|
||||
$time = time();
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$mon = date('n', $time);
|
||||
$year = date('Y', $time);
|
||||
$month[$time] = $monthger[$mon] . " " . $year;
|
||||
$time = strtotime('-1 month', $time);
|
||||
}
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
@@ -31,10 +61,21 @@ $daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
|
||||
.edit-placeholder {
|
||||
height: 15px;
|
||||
width: 19px;
|
||||
width: 27px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.fa-trash {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.text-bold {
|
||||
font-weight: 500;
|
||||
color: #000;
|
||||
}
|
||||
.text-normal {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!-- start page title -->
|
||||
@@ -64,12 +105,16 @@ $daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
|
||||
<select id="timerecordingCategory_id" name="timerecordingCategory_id"
|
||||
class="select2 form-control" required="required">
|
||||
<?php foreach ($timerecordingCategoriess as $timerecordingCategories): ?>
|
||||
<option value="<?= $timerecordingCategories->id ?>"
|
||||
data-approval="<?= $timerecordingCategories->approval ?>"
|
||||
data-comment="<?= $timerecordingCategories->require_comment ?>"
|
||||
data-hourday="<?= $timerecordingCategories->hourday ?>"><?= $timerecordingCategories->name ?></option>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($timerecordingCategoriess as $timerecordingCategories):
|
||||
if ($timerecordingCategories->only_admin == 0) :
|
||||
?>
|
||||
<option value="<?= $timerecordingCategories->id ?>"
|
||||
data-approval="<?= $timerecordingCategories->approval ?>"
|
||||
data-comment="<?= $timerecordingCategories->require_comment ?>"
|
||||
data-hourday="<?= $timerecordingCategories->hourday ?>"><?= $timerecordingCategories->name ?></option>
|
||||
<?php
|
||||
endif;
|
||||
endforeach; ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
@@ -126,6 +171,11 @@ $daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" row mt-2">
|
||||
<div class="col-lg-4" id="message-box">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -133,14 +183,58 @@ $daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
</div>
|
||||
<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 class="form-group module-row row mb-3">
|
||||
<div class="col-6 col-lg-1">
|
||||
<label class="col-form-label label-calendar" for="lenght">Buchungszeitraum:</label>
|
||||
</div>
|
||||
<div class="col-6 col-lg-1 text-center">
|
||||
<i class="fa-regular fa-calendar-week display-calendar active-calendar" title="Kalenderwoche"
|
||||
data-datatype="1"></i> <i class="fa-regular fa-calendar-days display-calendar"
|
||||
title="Kalendermonat" data-datatype="2"></i>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<div class="form-row">
|
||||
<div class="col" id="dataweek-col">
|
||||
<div class="input-group">
|
||||
<select id="dataweek" class="form-control select2">
|
||||
<?php foreach ($weeks as $key => $week): ?>
|
||||
<option value="<?= $key ?>"><?= $week ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col" id="datamonth-col" style="display:none">
|
||||
<div class="input-group">
|
||||
<select id="datamonth" class="form-control select2">
|
||||
<?php foreach ($month as $key => $Month): ?>
|
||||
<option value="<?= $key ?>"><?= $Month ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-row">
|
||||
<div class="col text-center">
|
||||
<div class="input-group ">
|
||||
<label class="col-form-label form-control"><span
|
||||
class="text-bold">Sollzeit: </span><span id="must-time"
|
||||
class="ml-1 text-normal"></span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-center">
|
||||
<div class="input-group ">
|
||||
<label class="col-form-label form-control"><span class="text-bold">Istzeit: </span><span
|
||||
id="is-time"
|
||||
class="ml-1 text-normal"></span></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<table id="datatable" class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -163,72 +257,6 @@ $daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
</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>';
|
||||
}
|
||||
?>
|
||||
<tr class="">
|
||||
<td data-order="<?= $orderdate ?>" class="text-nowrap "><?= $state ?><?= $day . " " . $date ?></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->commend ?></td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<?php if ($timerecording->completed == 0):
|
||||
if ($timerecording->approved == 0) : ?>
|
||||
<i class="far fa-edit edit-button" data-id="<?= $timerecording->id ?>"
|
||||
data-date="<?= $datadate ?>"
|
||||
data-category="<?= $timerecording->timerecordingCategory->id ?>"
|
||||
data-start="<?= $start ?>"
|
||||
data-end="<?= $end ?>"
|
||||
data-enddate="<?= $enddate ?>"
|
||||
data-commend="<?= $timerecording->commend ?>"
|
||||
title="Bearbeiten"></i>
|
||||
<?php else : ?>
|
||||
<div class="edit-placeholder"></div>
|
||||
<?php endif; ?>
|
||||
<a href="<?= self::getUrl("Timerecording", "delete", ["id" => $timerecording->id]) ?>"
|
||||
onclick="if(!confirm('Buchung wirklich löschen?')) return false;" class="text-danger"
|
||||
title="Löschen"><i class="fas fa-trash"></i></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -241,96 +269,14 @@ $daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [1, 2, 3, 6];
|
||||
let insertUrl = "<?= self::getUrl("Timerecording", "save") ?>";
|
||||
let deleteUrl = "<?= self::getUrl("Timerecording", "delete") ?>";
|
||||
let requestUrl = "<?= self::getUrl("Timerecording", "api", ['do' => 'getTimerecordings']) ?>";
|
||||
|
||||
$(document).ready(function () {
|
||||
$(".select2").select2();
|
||||
|
||||
$("body").on("change", "#timerecordingCategory_id", function () {
|
||||
if (parseInt($(this).find(':selected').data('hourday')) === 2) {
|
||||
$("#endtime-div").hide();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
});
|
||||
$("#enddate-div").show();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", true);
|
||||
$(this).prop("min", $('#date').val());
|
||||
$(this).val($('#date').val());
|
||||
})
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 1) {
|
||||
$("#endtime-div").show();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", true);
|
||||
$(this).prop("disabled", false);
|
||||
});
|
||||
$("#enddate-div").hide();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
})
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 3 || parseInt($(this).find(':selected').data('hourday')) === 4) {
|
||||
$("#endtime-div").hide();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("disabled", true);
|
||||
|
||||
});
|
||||
$("#enddate-div").hide();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
})
|
||||
}
|
||||
if (parseInt($(this).find(':selected').data('comment')) === 1) {
|
||||
$('#commend').prop("required", true);
|
||||
} else {
|
||||
$('#commend').prop("required", false);
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#date", function () {
|
||||
if ($('#enddate-div').css('display') === "block") {
|
||||
if ($('#date').val() > $('#enddate').val()) {
|
||||
$('#enddate').prop("min", $('#date').val());
|
||||
$('#enddate').val($('#date').val());
|
||||
}
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#date", function () {
|
||||
if ($('#endtime').css('display') === "block") {
|
||||
if ($('#start').val() > $('#end').val()) {
|
||||
console.log('größer');
|
||||
$('#end').prop("min", $('#start').val());
|
||||
$('#end').val($('#start').val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("body").on("click", ".edit-button", function () {
|
||||
$('#submit-button').hide().removeClass('btn-primary').addClass('btn-danger').show();
|
||||
$('#submit-button').text('Ändern');
|
||||
$('#cancel-button').show();
|
||||
$('#timerecordingCategory_id').val($(this).data('category')).change();
|
||||
$('#id').val($(this).data('id'));
|
||||
$('#date').val($(this).data('date'));
|
||||
$('#start').val($(this).data('start'));
|
||||
$('#end').val($(this).data('end'));
|
||||
$('#enddate').val($(this).data('enddate'));
|
||||
$('#commend').val($(this).data('commend'));
|
||||
$('.alert-success').remove();
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
$("body").on("click", "#cancel-button", function () {
|
||||
$('#submit-button').hide().removeClass('btn-danger').addClass('btn-primary').show();
|
||||
$('#submit-button').text('Speichern');
|
||||
$('#cancel-button').hide();
|
||||
$('#id').val('');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
src="<?= self::getResourcePath() ?>js/pages/timerecording/index.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
Reference in New Issue
Block a user