Zeiterfassung Fahrzeugverwaltung neue Features:

* KM-Stand History
* Journal
* Neue Felder
This commit is contained in:
Daniel Spitzer
2025-03-13 21:27:48 +01:00
parent e57a9a0eed
commit 93987b4341
15 changed files with 1237 additions and 234 deletions
+146 -23
View File
@@ -14,7 +14,13 @@ if ($firstApproval < time()) {
}
$approval = date("m/Y", $firstApproval);
$cartypes = TimerecordingCarModel::$carTypes;
if ($timerecordingcar->mileage_now && $timerecordingcar->mileage_timestamp) {
$mileagetimestamp = "(" . date("d.m.Y", $timerecordingcar->mileage_timestamp) . ")";
} elseif ($timerecordingcar->mileage_now) {
$mileagetimestamp = "(" . date("d.m.Y", $timerecordingcar->edit) . ")";
} else {
$mileagetimestamp = "";
}
?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= $git_merge_ts ?>" rel="stylesheet"
type="text/css"/>
@@ -24,6 +30,15 @@ $cartypes = TimerecordingCarModel::$carTypes;
table.dataTable.table-sm > thead > tr > th:not(.sorting_disabled) {
padding-right: 10px;
}
.show-milage-history {
cursor: pointer;
}
.fa-duotone.fa-clock-rotate-left:after, .fa-duotone.fa-history:after, .fad.fa-clock-rotate-left:after, .fad.fa-history:after {
content: "\f1da\f1da";
color: #218200;
opacity: 0.7;
}
</style>
<!-- start page title -->
<div class="row">
@@ -92,13 +107,32 @@ $cartypes = TimerecordingCarModel::$carTypes;
<th>Model/Typ</th>
<td><?= $timerecordingcar->model ?></td>
</tr>
<tr>
<th>Fahrzeugverwalter</th>
<td><?= ($timerecordingcar->user_id) ? $timerecordingcar->user->name : "-" ?></td>
</tr>
<tr>
<th>Fahrtenbuch</th>
<td><?= ($timerecordingcar->timerecording) ? "Ja" : "Nein" ?></td>
</tr>
<tr>
<th>Erste §57a nach</th>
<td><?= ($timerecordingcar->first_approval) ? $timerecordingcar->first_approval . " Jahr(en)" : "-" ?></td>
</tr>
<tr>
<th>Fahrzeugverwalter</th>
<td><?= ($timerecordingcar->user_id) ? $timerecordingcar->user->name : "-" ?></td>
<th>Erstzulassung</th>
<td><?= ($timerecordingcar->initial_approval) ? date("m/Y", $timerecordingcar->initial_approval) : "-" ?></td>
</tr>
<?php if ($timerecordingcar->override_approval) : ?>
<tr>
<th>§57a Korrektur</th>
<td><?= ($timerecordingcar->initial_approval) ? date("m/Y", $timerecordingcar->override_approval) : "-" ?></td>
</tr>
<?php endif; ?>
<tr>
<th>Nächste $57a</th>
<td><?= ($timerecordingcar->initial_approval) ? $approval : "-" ?></td>
</tr>
</tbody>
</table>
@@ -109,30 +143,49 @@ $cartypes = TimerecordingCarModel::$carTypes;
<table class="table table-sm">
<tbody>
<tr>
<th>Fahrtenbuch</th>
<td><?= ($timerecordingcar->timerecording) ? "Ja" : "Nein" ?></td>
<th>Serviceintervall</th>
<td><?= ($timerecordingcar->service_interval) ?: "-" ?></td>
</tr>
<tr>
<th>Erstzulassung</th>
<td><?= ($timerecordingcar->initial_approval) ? date("m/Y", $timerecordingcar->initial_approval) : "-" ?></td>
<th>Sommerreifen</th>
<td><?= ($timerecordingcar->summer_tires) ?: "-" ?></td>
</tr>
<?php if ($timerecordingcar->override_approval) : ?>
<tr>
<th>§57a Korrektur</th>
<td><?= ($timerecordingcar->initial_approval) ? date("m/Y", $timerecordingcar->override_approval) : "-" ?></td>
</tr>
<?php endif; ?>
<tr>
<th>Nächste $57a</th>
<td><?= ($timerecordingcar->initial_approval) ? $approval : "-" ?></td>
<th>Winterreifen</th>
<td><?= ($timerecordingcar->winter_tires) ?: "-" ?></td>
</tr>
<tr>
<th>Reifen engelagert</th>
<td><?= ($timerecordingcar->tires_at) ?: "-" ?></td>
</tr>
<tr>
<th>Motoröl</th>
<td><?= ($timerecordingcar->oil_type) ?: "-" ?></td>
</tr>
<tr>
<th>Werkstätte</th>
<td><?= ($timerecordingcar->service_station) ?: "-" ?></td>
</tr>
<tr>
<th class="w-30">Kilometerstand</th>
<td><?= ($timerecordingcar->mileage_now) ? $timerecordingcar->mileage_now . " KM" : "-" ?></td>
<td><?= ($timerecordingcar->mileage_now) ? $timerecordingcar->mileage_now . " KM" : "-" ?> <?= $mileagetimestamp ?> <?= ($timeRecordingCarMileageHistory) ? '<span class="float-right"><i class="fa-solid fa-arrow-up show-milage-history"></i></span> ' : '' ?></td>
</tr>
<?php if ($timeRecordingCarMileageHistory) : ?>
<tbody id="mileagetable" class="border-0" style="display:none;">
<?php foreach ($timeRecordingCarMileageHistory as $timeRecordingCarMileagehistory) : ?>
<tr>
<td></td>
<td><?= $timeRecordingCarMileagehistory->mileage ?> KM
(<?= date("d.m.Y", $timeRecordingCarMileagehistory->mileage_timestamp) ?>
)
</td>
</tr>
<?php
endforeach;
endif; ?>
</tbody>
</tbody>
</table>
</div>
@@ -141,9 +194,10 @@ $cartypes = TimerecordingCarModel::$carTypes;
</div>
</div>
</div>
<?php if ($timerecordingcarDokuments) : ?>
<div class="col-12 col-lg-4 card-border pr-0 pl-lg-1">
<div class="card">
<div class="col-12 col-lg-4 card-border pr-0 pl-lg-1">
<?php if ($timerecordingcarDokuments) : ?>
<div class="card mb-2">
<div class="card-body">
<div class="row">
<div class="col-12">
@@ -182,8 +236,30 @@ $cartypes = TimerecordingCarModel::$carTypes;
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>
<?php endif;
if ($timerecordingCarJournal) :
?>
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-12 mb-0">
<h4>Journaleintrag
<div class="d-inline-block ml-1 align-center"><i data-toggle="modal"
data-target="#journalModal"
class="fa-duotone fa-solid fa-clock-rotate-left"></i>
</div>
</h4>
<span class="pl-1"><?= date("d.m.Y", $timerecordingCarJournal[0]->timestamp) ?> (<?= $timerecordingCarJournal[0]->creator->name ?>)</span>
</div>
<div class="col-12 mb-0">
<div class="pl-2 pt-1"><?= nl2br($timerecordingCarJournal[0]->journal) ?></div>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
@@ -261,14 +337,61 @@ $cartypes = TimerecordingCarModel::$carTypes;
</div>
</div>
<div class="modal fade" id="journalModal" tabindex="-1" role="dialog" aria-labelledby="journalModalTitle"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Journaleinträge</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<?php foreach ($timerecordingCarJournal as $timerecordingjournal): ?>
<div class="card mb-1 mt-1">
<div class="card-body ">
<div class="row">
<div class="col-12 mb-0 pl-1">
<div class="pl-2 pt-1"><?= date("d.m.Y", $timerecordingjournal->timestamp) ?>
(<?= $timerecordingjournal->creator->name ?>)
</div>
</div>
<div class="col-12 mb-0 ">
<div class="pl-2 pt-1"><?= nl2br($timerecordingjournal->journal) ?></div>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var hidesearch = [7];
$(document).ready(function () {
$('body').on('click', '.show-milage-history', function () {
if ($(this).hasClass("fa-arrow-up")) {
$('#mileagetable').show();
$(this).removeClass("fa-arrow-up");
$(this).addClass("fa-arrow-down");
} else {
$('#mileagetable').hide();
$(this).removeClass("fa-arrow-down");
$(this).addClass("fa-arrow-up");
}
});
});
</script>
<script type="text/javascript"