Zeiterfassung Update

* Neue migration für Homeoffice
 * Soll zeiten nun vom Startdatum abhängig
 * Neue Summierung der Sollzeiten in der Personalverwaltung
 * Urlaubstage werden nun Tage statt Stunden angezeigt (in Buchungen und Auswertungen)
 * Urlaube werden nun bis 1.1.2024 berücksichtigt
 * Homeoffice Flag nun möglich
This commit is contained in:
Spitzer Daniel
2024-03-04 13:57:44 +01:00
parent 65d313b6d1
commit ee5ab065d8
8 changed files with 164 additions and 14 deletions

View File

@@ -126,7 +126,9 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
data-approval="<?= $timerecordingCategories->approval ?>"
data-comment="<?= $timerecordingCategories->require_comment ?>"
data-hourday="<?= $timerecordingCategories->hourday ?>"
data-businesstrip="<?= $timerecordingCategories->businesstrip ?>"><?= $timerecordingCategories->name ?></option>
data-businesstrip="<?= $timerecordingCategories->businesstrip ?>"
data-homeoffice="<?= ($timerecordingCategories->hourday==1) ? 1 : 0 ?>"><?= $timerecordingCategories->name ?></option>
</option>
<?php
endif;
endforeach; ?>
@@ -179,9 +181,19 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
</div>
<div class="row" id="businesstrip-div">
<div class="row" >
<div class="col-lg-1 mb-2" id="homeoffice-div">
<div class="col-lg-2 mb-2">
<div class="form-check text-center mt-1">
<input class="form-check-input" type="checkbox" name="homeoffice"
id="homeoffice" value="1">
<label class="form-check-label" for="homeoffice">
Homeoffice
</label>
</div>
</div>
<div class="col-lg-2 mb-2 businesstrip-div">
<div class="form-check text-center mt-1">
<input class="form-check-input" type="checkbox" name="businesstrip"
@@ -191,7 +203,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
</label>
</div>
</div>
<div class="col-lg-2">
<div class="col-lg-2 businesstrip-div">
<input style="display:none" type="text" id="businesstrip_info" name="businesstrip_info"
placeholder="Ort"
class="form-control"/>

View File

@@ -140,7 +140,8 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
data-approval="<?= $timerecordingCategories->approval ?>"
data-comment="<?= $timerecordingCategories->require_comment ?>"
data-hourday="<?= $timerecordingCategories->hourday ?>"
data-businesstrip="<?= $timerecordingCategories->businesstrip ?>"><?= $timerecordingCategories->name ?></option>
data-businesstrip="<?= $timerecordingCategories->businesstrip ?>"
data-homeoffice="<?= ($timerecordingCategories->hourday==1) ? 1 : 0 ?>"><?= $timerecordingCategories->name ?></option>
<?php
endforeach; ?>
</select>
@@ -192,9 +193,18 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
</div>
</div>
<div class="row" id="businesstrip-div">
<div class="row" >
<div class="col-lg-1 mb-2" id="homeoffice-div">
<div class="col-lg-2 mb-2">
<div class="form-check text-center mt-1">
<input class="form-check-input" type="checkbox" name="homeoffice"
id="homeoffice" value="1">
<label class="form-check-label" for="homeoffice">
Homeoffice
</label>
</div>
</div>
<div class="col-lg-2 mb-2 businesstrip-div">
<div class="form-check text-center mt-1">
<input class="form-check-input" type="checkbox" name="businesstrip"
@@ -204,7 +214,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
</label>
</div>
</div>
<div class="col-lg-2">
<div class="col-lg-2 businesstrip-div">
<input style="display:none" type="text" id="businesstrip_info" name="businesstrip_info"
placeholder="Ort"
class="form-control"/>

View File

@@ -207,10 +207,14 @@ class TimerecordingController extends mfBaseController
$data['comment'] = trim($r->comment);
$data['businesstrip'] = $r->businesstrip;
$data['businesstrip_info'] = $r->businesstrip_info;
$data['homeoffice'] = $r->homeoffice;
if (!$data['businesstrip'] || $data['businesstrip'] == "false") {
$data['businesstrip'] = 0;
}
if (!$data['homeoffice'] || $data['homeoffice'] == "false") {
$data['homeoffice'] = 0;
}
if ($r->businesstrip == 1 && !$r->businesstrip_info) {
$result['state'] = "error";
$result['error'] = "Geschäftsreiseinformationen darf nicht leer sein";
@@ -640,7 +644,9 @@ class TimerecordingController extends mfBaseController
}
$edit = "";
if ($timerecording->businesstrip == 1) {
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-2'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
} else if ($timerecording->homeoffice == 1) {
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Homeoffice)</span>";
} else {
$category = $timerecording->timerecordingCategory->name;
}
@@ -660,6 +666,7 @@ class TimerecordingController extends mfBaseController
data-comment="' . $timerecording->comment . '"
data-businesstrip="' . $timerecording->businesstrip . '"
data-businesstripinfo="' . $timerecording->businesstrip_info . '"
data-homeoffice="' . $timerecording->homeoffice . '"
title="Bearbeiten"></i>';
else :
$edit .= '<div class="edit-placeholder"></div>';

View File

@@ -8,6 +8,7 @@ class TimerecordingModel
private $timerecordingCategory_id;
private $businesstrip;
private $businesstrip_info;
private $homeoffice;
private $comment;
private $approved;
private $completed;

View File

@@ -269,6 +269,8 @@ class TimerecordingReportController extends mfBaseController
$edit = "";
if ($timerecording->businesstrip == 1) {
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
} else if ($timerecording->homeoffice == 1) {
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Homeoffice)</span>";
} else {
$category = $timerecording->timerecordingCategory->name;
}
@@ -289,6 +291,7 @@ class TimerecordingReportController extends mfBaseController
data-userid="' . $timerecording->user_id . '"
data-businesstrip="' . $timerecording->businesstrip . '"
data-businesstripinfo="' . $timerecording->businesstrip_info . '"
data-homeoffice="' . $timerecording->homeoffice . '"
title="Bearbeiten"></i>';
else :
$edit .= '<div class="edit-placeholder"></div>';

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class TimerecordingAddFieldsHomeoffice extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Timerecording", ["signed" => true]);
$table->addColumn("homeoffice", "integer", ["null" => false, "default" => '0', "after" => "businesstrip_info"]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("Timerecording")->removeColumn("homeoffice")->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}

View File

@@ -224,16 +224,24 @@ $(document).ready(function () {
}
if (parseInt($(this).find(':selected').data('businesstrip')) === 1) {
$('#businesstrip-div').show();
$('.businesstrip-div').show();
$('#businesstrip').prop("checked", false);
$('#businesstrip_info').val('');
$('#businesstrip_info').hide();
} else {
$('#businesstrip-div').hide();
$('.businesstrip-div').hide();
$('#businesstrip').prop("checked", false);
$('#businesstrip_info').val('');
$('#businesstrip_info').hide();
}
if (parseInt($(this).find(':selected').data('homeoffice')) === 1) {
$('#homeoffice-div').show();
$('#homeoffice').prop("checked", false);
} else {
$('#homeoffice').prop("checked", false);
$('#homeoffice-div').hide();
}
});
$("body").on("change", "#date", function () {
if ($('#enddate-div').css('display') === "block") {
@@ -269,6 +277,12 @@ $(document).ready(function () {
$('#businesstrip_info').val($(this).data('businesstripinfo'));
$('#businesstrip_info').show();
$('#businesstrip_info').prop('required', true);
$('#homeoffice-div').hide();
}
if ($(this).data('homeoffice') == 1) {
$('.businesstrip-div').hide();
$('#homeoffice').prop("checked", true);
$('#homeoffice-div').show();
}
$('.alert-success').remove();
window.scrollTo(0, 0);
@@ -278,6 +292,12 @@ $(document).ready(function () {
$('#submit-button').text('Speichern');
$('#cancel-button').hide();
$('#id').val('');
$('.businesstrip-div').hide();
$('#businesstrip').prop("checked", false);
$('#businesstrip_info').val('');
$('#businesstrip_info').hide();
$('#homeoffice').prop("checked", false);
$('#timerecordingCategory_id').change();
});
$("body").on("change", "#dataweek,#datamonth,#datayear", function () {
@@ -312,15 +332,33 @@ $(document).ready(function () {
if ($(this).prop('checked') == true) {
$('#businesstrip_info').show();
$('#businesstrip_info').prop('required', true);
$('#homeoffice').prop('checked', false);
$('#homeoffice-div').hide();
} else {
$('#businesstrip_info').hide();
$('#businesstrip_info').val('');
$('#businesstrip_info').prop('required', false);
$('#timerecordingCategory_id').change();
}
});
$("body").on("click", "#homeoffice", function () {
if ($(this).prop('checked') == true) {
$('#businesstrip').prop('checked', false);
$('.businesstrip-div').hide();
$('#businesstrip_info').hide();
$('#businesstrip_info').val('');
$('#businesstrip_info').prop('required', false);
} else {
$('#timerecordingCategory_id').change();
}
});
$("body").on("click", "#auto-workinghours-button", function () {
var timestamp = $('#dataweek').val() * 1000
const date = new Date(timestamp);
@@ -363,9 +401,13 @@ $(document).ready(function () {
e.preventDefault();
$('#alert-box').remove();
var businesstrip = false;
var homeoffice = false;
if ($('#businesstrip').prop('checked') == true) {
businesstrip = 1;
}
if ($('#homeoffice').prop('checked') == true) {
homeoffice = 1;
}
$.post(insertUrl, {
id: $.trim($('#id').val()),
timerecordingCategory_id: $.trim($('#timerecordingCategory_id').val()),
@@ -376,6 +418,7 @@ $(document).ready(function () {
comment: $.trim($('#comment').val()),
businesstrip: businesstrip,
businesstrip_info: $.trim($('#businesstrip_info').val()),
homeoffice: homeoffice,
hourday: $.trim($('#timerecordingCategory_id').find(':selected').data('hourday')),
ajax: 1
}).done(function (data) {

View File

@@ -229,16 +229,24 @@ $(document).ready(function () {
}
if (parseInt($(this).find(':selected').data('businesstrip')) === 1) {
$('#businesstrip-div').show();
$('.businesstrip-div').show();
$('#businesstrip').prop("checked", false);
$('#businesstrip_info').val('');
$('#businesstrip_info').hide();
} else {
$('#businesstrip-div').hide();
$('.businesstrip-div').hide();
$('#businesstrip').prop("checked", false);
$('#businesstrip_info').val('');
$('#businesstrip_info').hide();
}
if (parseInt($(this).find(':selected').data('homeoffice')) === 1) {
$('#homeoffice-div').show();
$('#homeoffice').prop("checked", false);
} else {
$('#homeoffice').prop("checked", false);
$('#homeoffice-div').hide();
}
});
$("body").on("change", "#date", function () {
if ($('#enddate-div').css('display') === "block") {
@@ -280,18 +288,31 @@ $(document).ready(function () {
$('#businesstrip_info').val($(this).data('businesstripinfo'));
$('#businesstrip_info').show();
$('#businesstrip_info').prop('required', true);
$('#homeoffice-div').hide();
}
if ($(this).data('homeoffice') == 1) {
$('.businesstrip-div').hide();
$('#homeoffice').prop("checked", true);
$('#homeoffice-div').show();
}
$('.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();
$('#user_id_select').prop('disabled', false);
$('#user_id_input').prop('disabled', true);
$('#user_id_select').change();
$('#timerecordingCategory_id').val($(this).data('category')).change();
$('#timerecordingCategory_id').change();
$('#id').val('');
$('.businesstrip-div').hide();
$('#businesstrip').prop("checked", false);
$('#businesstrip_info').val('');
$('#businesstrip_info').hide();
$('#homeoffice').prop("checked", false);
$('#timerecordingCategory_id').change();
});
$("body").on("change", "#dataweek,#datamonth,#datayear", function () {
@@ -355,11 +376,28 @@ $(document).ready(function () {
if ($(this).prop('checked') == true) {
$('#businesstrip_info').show();
$('#businesstrip_info').prop('required', true);
$('#homeoffice').prop('checked', false);
$('#homeoffice-div').hide();
} else {
$('#businesstrip_info').hide();
$('#businesstrip_info').val('');
$('#businesstrip_info').prop('required', false);
$('#timerecordingCategory_id').change();
}
});
$("body").on("click", "#homeoffice", function () {
if ($(this).prop('checked') == true) {
$('#businesstrip').prop('checked', false);
$('.businesstrip-div').hide();
$('#businesstrip_info').hide();
$('#businesstrip_info').val('');
$('#businesstrip_info').prop('required', false);
} else {
$('#timerecordingCategory_id').change();
}
@@ -382,9 +420,13 @@ $(document).ready(function () {
var userid;
userid = $('#user_id_select').val();
var businesstrip = false;
var homeoffice = false;
if ($('#businesstrip').prop('checked') == true) {
businesstrip = 1;
}
if ($('#homeoffice').prop('checked') == true) {
homeoffice = 1;
}
$.post(insertUrl, {
id: $.trim($('#id').val()),
user_id: userid,
@@ -396,6 +438,7 @@ $(document).ready(function () {
comment: $.trim($('#comment').val()),
businesstrip: businesstrip,
businesstrip_info: $.trim($('#businesstrip_info').val()),
homeoffice: homeoffice,
hourday: $.trim($('#timerecordingCategory_id').find(':selected').data('hourday')),
ajax: 1
}).done(function (data) {