diff --git a/application/Timerecording/TimerecordingController.php b/application/Timerecording/TimerecordingController.php
index 5edcce29c..81d9215e1 100644
--- a/application/Timerecording/TimerecordingController.php
+++ b/application/Timerecording/TimerecordingController.php
@@ -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 = "
" . $timerecording->timerecordingCategory->name . " (Dienstreise: " . $timerecording->businesstrip_info . ")";
+ $category = "
" . $timerecording->timerecordingCategory->name . " (Dienstreise: " . $timerecording->businesstrip_info . ")";
+ } else if ($timerecording->homeoffice == 1) {
+ $category = "
" . $timerecording->timerecordingCategory->name . " (Homeoffice)";
} 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">';
else :
$edit .= '
';
diff --git a/application/Timerecording/TimerecordingModel.php b/application/Timerecording/TimerecordingModel.php
index cfd5833e7..5966253c4 100644
--- a/application/Timerecording/TimerecordingModel.php
+++ b/application/Timerecording/TimerecordingModel.php
@@ -8,6 +8,7 @@ class TimerecordingModel
private $timerecordingCategory_id;
private $businesstrip;
private $businesstrip_info;
+ private $homeoffice;
private $comment;
private $approved;
private $completed;
diff --git a/application/TimerecordingReport/TimerecordingReportController.php b/application/TimerecordingReport/TimerecordingReportController.php
index c2a576960..48b80efbf 100644
--- a/application/TimerecordingReport/TimerecordingReportController.php
+++ b/application/TimerecordingReport/TimerecordingReportController.php
@@ -269,6 +269,8 @@ class TimerecordingReportController extends mfBaseController
$edit = "";
if ($timerecording->businesstrip == 1) {
$category = "
" . $timerecording->timerecordingCategory->name . " (Dienstreise: " . $timerecording->businesstrip_info . ")";
+ } else if ($timerecording->homeoffice == 1) {
+ $category = "
" . $timerecording->timerecordingCategory->name . " (Homeoffice)";
} 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">';
else :
$edit .= '
';
diff --git a/db/migrations/20240304113235_timerecording_add_fields_homeoffice.php b/db/migrations/20240304113235_timerecording_add_fields_homeoffice.php
new file mode 100644
index 000000000..ed7060f76
--- /dev/null
+++ b/db/migrations/20240304113235_timerecording_add_fields_homeoffice.php
@@ -0,0 +1,31 @@
+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") {
+
+ }
+ }
+}
diff --git a/public/js/pages/timerecording/index.js b/public/js/pages/timerecording/index.js
index 6bfceedec..e2bf423bb 100644
--- a/public/js/pages/timerecording/index.js
+++ b/public/js/pages/timerecording/index.js
@@ -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) {
diff --git a/public/js/pages/timerecordingReport/index.js b/public/js/pages/timerecordingReport/index.js
index e7714c9e5..b43a83b60 100644
--- a/public/js/pages/timerecordingReport/index.js
+++ b/public/js/pages/timerecordingReport/index.js
@@ -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) {