Zeiterfassungs Update

* Implementerung Fahrzeugverwaltung
 * neue Buchungsart Fahrtenbuch
 * Diverse Bugfixes
This commit is contained in:
Spitzer Daniel
2024-03-26 08:08:01 +01:00
parent 81e3b1ccd5
commit 025522a740
18 changed files with 1305 additions and 38 deletions
+86 -5
View File
@@ -223,7 +223,25 @@ $(document).ready(function () {
$(this).prop("min", '');
$(this).val('');
})
} else if (parseInt($(this).find(':selected').data('hourday')) === 7) {
$("#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('');
})
$('#businesstrip_info').val('');
$('#businesstrip_info').show();
$('.car-div-car').show();
}
if (parseInt($(this).find(':selected').data('comment')) === 1) {
$('#comment').prop("required", true);
} else {
@@ -235,11 +253,28 @@ $(document).ready(function () {
$('#businesstrip').prop("checked", false);
$('#businesstrip_info').val('');
$('#businesstrip_info').hide();
$('.car-div').find('input').prop("required", false);
$('.car-div').find('input').val('');
$('#timerecordingCar_id').val('').change();
$('.car-div').hide();
} else if (parseInt($(this).find(':selected').data('hourday')) === 7) {
$('.businesstrip-div').show();
$('.businesstrip-check-div').hide();
$('#businesstrip').prop("checked", true);
$('#businesstrip_info').show();
$('#businesstrip_info').prop('required', true);
$('#homeoffice-div').hide();
} else {
$('.businesstrip-div').hide();
$('#businesstrip').prop("checked", false);
$('#businesstrip_info').val('');
$('#timerecordingCar_id').val('').change();
$('.car-div').find('input').prop("required", false);
$('.car-div').find('input').val('');
$('.car-div').hide();
$('#businesstrip_info').hide();
}
if (parseInt($(this).find(':selected').data('homeoffice')) === 1) {
@@ -306,12 +341,25 @@ $(document).ready(function () {
$('#businesstrip_info').show();
$('#businesstrip_info').prop('required', true);
$('#homeoffice-div').hide();
$('#timerecordingCar_id').val('').change();
}
if ($(this).data('homeoffice') == 1) {
$('.businesstrip-div').hide();
$('#homeoffice').prop("checked", true);
$('#homeoffice-div').show();
}
if ($(this).data('car')) {
$('#timerecordingCar_id').val($(this).data('car')).change();
if ($(this).data('mileagestart')) {
$('.car-div').show();
$('.car-div').find('input').prop("required", true);
$('#mileage_start').val($(this).data('mileagestart'));
$('#mileage_end').val($(this).data('mileageend'));
} else {
}
}
$('.alert-success').remove();
window.scrollTo(0, 0);
});
@@ -324,8 +372,14 @@ $(document).ready(function () {
$('#businesstrip').prop("checked", false);
$('#businesstrip_info').val('');
$('#businesstrip_info').hide();
$('#businesstrip_info').prop("required", false);
$('#homeoffice').prop("checked", false);
$('.car-div').hide();
$('.car-div').find('input').val('');
$('.car-div').find('input').prop("required", false);
$('#timerecordingCar_id').val('').change();
$('#timerecordingCategory_id').change();
});
$("body").on("change", "#dataweek,#datamonth,#datayear", function () {
@@ -362,7 +416,7 @@ $(document).ready(function () {
$('#businesstrip_info').prop('required', true);
$('#homeoffice').prop('checked', false);
$('#homeoffice-div').hide();
$('.car-div-car').show();
} else {
$('#businesstrip_info').hide();
$('#businesstrip_info').val('');
@@ -376,6 +430,10 @@ $(document).ready(function () {
if ($(this).prop('checked') == true) {
$('#businesstrip').prop('checked', false);
$('.businesstrip-div').hide();
$('#timerecordingCar_id').val('');
$('.car-div').find('input').prop("required", false);
$('.car-div').find('input').val('');
$('.car-div').hide();
$('#businesstrip_info').hide();
$('#businesstrip_info').val('');
$('#businesstrip_info').prop('required', false);
@@ -414,6 +472,19 @@ $(document).ready(function () {
});
$("body").on("change", "#timerecordingCar_id", function () {
if ($('#timerecordingCar_id').val() == "") {
$('.car-div').find('input').prop("required", false);
$('.car-div').find('input').val('');
$('.car-div').hide();
$('.car-div-car').show();
} else {
$('.car-div').show();
$('.car-div').find('input').prop("required", true);
$('#mileage_start').val($(this).find(':selected').data('mileagenow'));
}
});
$("body").on("click", ".delete-item", function () {
if (confirm('Buchung wirklich löschen?')) {
$.post(deleteUrl, {
@@ -430,12 +501,16 @@ $(document).ready(function () {
$('#alert-box').remove();
var businesstrip = false;
var homeoffice = false;
var car = false;
if ($('#businesstrip').prop('checked') == true) {
businesstrip = 1;
}
if ($('#homeoffice').prop('checked') == true) {
homeoffice = 1;
}
if ($.trim($('#timerecordingCar_id').val())) {
car = 1;
}
$.post(insertUrl, {
id: $.trim($('#id').val()),
timerecordingCategory_id: $.trim($('#timerecordingCategory_id').val()),
@@ -446,6 +521,9 @@ $(document).ready(function () {
comment: $.trim($('#comment').val()),
businesstrip: businesstrip,
businesstrip_info: $.trim($('#businesstrip_info').val()),
timerecordingCar_id: $.trim($('#timerecordingCar_id').val()),
mileage_start: $.trim($('#mileage_start').val()),
mileage_end: $.trim($('#mileage_end').val()),
homeoffice: homeoffice,
hourday: $.trim($('#timerecordingCategory_id').find(':selected').data('hourday')),
ajax: 1
@@ -459,10 +537,13 @@ $(document).ready(function () {
<h5><i class="icon fas fa-check"></i> Erfolgreich</h5>
` + result.message + `</div>
</div>`);
$('#businesstrip').prop('checked', false);
$('#businesstrip_info').hide();
$('#businesstrip_info').val('');
$('#businesstrip_info').prop('required', false);
if ($.trim($('#mileage_start').val())) {
$('#timerecordingCar_id').find(':selected').data('mileagenow', $.trim($('#mileage_end').val()));
}
if (car == 1) {
$('#timerecordingCar_id').val('').change();
}
}
if (result.state === "error") {
$('.wrapper .container-fluid').prepend(`<div id="alert-box" class="row">