Files
thetool/Layout/default/TimerecordingCar/Detail.php
Daniel Spitzer 7d176779c9 Zeiterfassung neues Feature:
Features für Project 7832:
* Das Pickerldatum Zusatzfeld
* Auftrennen PKW und Anhänger
* Dokumente Upload
* Standardsortierung
* Ausgeschieden Flag mit Datum
* zusätzliche migration
2025-03-10 08:04:56 +01:00

272 lines
14 KiB
PHP

<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
$initialApproval = date("Y-m-d H:i:s", $timerecordingcar->initial_approval);
$initialApprovalMonth = date("m", $timerecordingcar->initial_approval);
if ($timerecordingcar->override_approval) {
$overrideApproval = date("Y-m-d H:i:s", $timerecordingcar->override_approval);
$initialApprovalMonth = date("m", $timerecordingcar->override_approval);
}
$firstApproval = strtotime('+' . $timerecordingcar->first_approval . 'years', strtotime($initialApproval));
if ($firstApproval < time()) {
$firstApproval = strtotime(date("Y-$initialApprovalMonth-01", time()));
if ($firstApproval < time()) {
$firstApproval = strtotime(date("Y-$initialApprovalMonth-01", strtotime('+1 year')));
}
}
$approval = date("m/Y", $firstApproval);
$cartypes = TimerecordingCarModel::$carTypes;
?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<link href="<?= self::getResourcePath() ?>css/pages/TimerecordingCar/Form.css?<?= $git_merge_ts ?>" rel="stylesheet"
type="text/css"/>
<style>
table.dataTable.table-sm > thead > tr > th:not(.sorting_disabled) {
padding-right: 10px;
}
</style>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item"><a href="<?= self::getUrl("TimerecordingCar") ?>">Fahrzeuge</a>
</li>
<li class="breadcrumb-item active"><?= $timerecordingcar->number_plate ?></li>
</ol>
</div>
<h4 class="page-title"><?= $timerecordingcar->brand . "/" . $timerecordingcar->model . " (" . $timerecordingcar->number_plate . ")" ?>
Detail
<span class="ml-2">
<a href="<?= self::getUrl("TimerecordingCar", "edit", ["id" => $timerecordingcar->id, 'returnto' => "detail"]) ?>">
<button class="btn btn-primary">Bearbeiten</button>
</a>
</span>
</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-12 col-lg-8 card-border pr-0 pr-lg-1">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-4">
<h4>Fahrzeug Informationen </h4>
<?php if ($timerecordingcar->retired_date): ?>
<div class="alert alert-danger font-weight-500" role="alert">
Fahrzeug ausgeschieden
am <?= date("d.m.Y", $timerecordingcar->retired_date) ?>
von <?= $timerecordingcar->editor->name ?>
</div>
<?php endif; ?>
</div>
</div>
<div class="row">
<div class="col-12 col-lg-6">
<table class="table table-sm">
<tbody>
<tr>
<th class="w-30">Fahrzeugtyp</th>
<td><?= $cartypes[$timerecordingcar->type] ?></td>
</tr>
<tr>
<th class="w-30">Marke</th>
<td><?= $timerecordingcar->brand ?></td>
</tr>
<tr>
<th>Model/Typ</th>
<td><?= $timerecordingcar->model ?></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>
</tr>
</tbody>
</table>
</div>
<div class="col-12 col-lg-6 card-border">
<div>
<table class="table table-sm">
<tbody>
<tr>
<th>Fahrtenbuch</th>
<td><?= ($timerecordingcar->timerecording) ? "Ja" : "Nein" ?></td>
</tr>
<tr>
<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>
<tr>
<th class="w-30">Kilometerstand</th>
<td><?= ($timerecordingcar->mileage_now) ? $timerecordingcar->mileage_now . " KM" : "-" ?></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</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="card-body">
<div class="row">
<div class="col-12">
<h4>Dokumente </h4>
</div>
</div>
<?php foreach ($timerecordingcarDokuments as $timerecordingcarDokument) :
$filesize = $timerecordingcarDokument->file_size;
if ($filesize < 1024) {
$filesize = number_format($filesize, 2) . " B";
} elseif ($filesize < 1024 * 1024) {
$filesize = number_format($filesize / 1024, 2) . " KB";
} else {
$filesize = number_format($filesize / 1024 / 1024, 2) . " MB";
}
$uploadDate = date("d.m.y", $timerecordingcarDokument->file->create);
$mimetype = $timerecordingcarDokument->file->mimetype;
if (!array_key_exists($mimetype, $mimetypes)) {
$mimetype = "fa-file";
} else
$mimetype = $mimetypes[$mimetype];
?>
<div class="doc-main-div border-bottom mb-1"
data-name="<?= $timerecordingcarDokument->file->name ?>">
<div class="d-inline-block doc-icon-div"><i
class="fa-duotone fa-solid <?= $mimetype ?>"></i>
</div>
<div class="d-inline-block doc-content-div"
style="margin-left: -3px;"><a
href="<?= self::getUrl("File", "download", ["id" => $timerecordingcarDokument->file_id]) ?>"
target="_blank"><?= $timerecordingcarDokument->file->name ?></a>
</div>
<span class="mt-2px float-right ml-1">(<?= $uploadDate ?>)</span>
<span class="mt-2px float-right"><?= $filesize ?></span>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
</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">Fahrtenbuch</h4>
</div>
<div class="float-right">
</div>
</div>
</div>
<table id="datatable" class="table table-striped table-hover table-sm">
<thead>
<tr>
<th class="text-center">Startkilometer</th>
<th class="text-center">Endkilometer</th>
<th class="text-center">Kilometer</th>
<th class="text-center">Fahrer</th>
<th class="text-center">Datum</th>
<th class="text-center">Zeit</th>
<th class="text-center">Ort</th>
<th class="edit-width"></th>
</tr>
<tr id="filterrow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($timerecordings as $timerecording): ?>
<tr>
<td class="text-center"><?= $timerecording->mileage_start ?> KM</td>
<td class="text-center"><?= $timerecording->mileage_end ?> KM</td>
<td class="text-center"><?= $timerecording->mileage_end - $timerecording->mileage_start ?>
KM
<td class="text-center"><?= $timerecording->user->name ?></td>
<td data-order="<?= $timerecording->start ?>"
class="text-center"><?= date("d.m.Y", $timerecording->start) ?></td>
<td class="text-center"><?= date("H:i", $timerecording->start) . " - " . date("H:i", $timerecording->end) ?></td>
</td>
<td class="text-center"><?= $timerecording->businesstrip_info ?></td>
</td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<!-- <a href="-->
<?php //= self::getUrl("TimerecordingCar", "edit", ["id" => $timerecordingcar->id]) ?><!--"><i-->
<!-- class="far fa-edit" title="Bearbeiten"></i></a>-->
<!-- <a href="-->
<?php //= self::getUrl("TimerecordingCar", "delete", ["id" => $timerecordingcar->id]) ?><!--"-->
<!-- onclick="if(!confirm('Auto wirklich löschen?')) return false;" class="text-danger"-->
<!-- title="Löschen"><i class="fas fa-trash"></i></a>-->
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var hidesearch = [7];
$(document).ready(function () {
});
</script>
<script type="text/javascript"
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>