Features für Project 7832: * Das Pickerldatum Zusatzfeld * Auftrennen PKW und Anhänger * Dokumente Upload * Standardsortierung * Ausgeschieden Flag mit Datum * zusätzliche migration
294 lines
20 KiB
PHP
294 lines
20 KiB
PHP
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
|
if (isset($_GET['returnto']) && $_GET['returnto'] == "detail") {
|
|
$cancelUrl = self::getUrl("TimerecordingCar", "Detail", ["id" => $timerecordingcars->id]);
|
|
} else {
|
|
$cancelUrl = self::getUrl("TimerecordingCar");
|
|
}
|
|
foreach ($timerecordingusers as $timerecordinguser) {
|
|
$timerecordingUsers[$timerecordinguser->name] = $timerecordinguser->id;
|
|
}
|
|
ksort($timerecordingUsers);
|
|
|
|
$cartypes = TimerecordingCarModel::$carTypes;
|
|
|
|
?>
|
|
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= $git_merge_ts ?>" rel="stylesheet"
|
|
type="text/css"/>
|
|
<link href="<?= self::getResourcePath() ?>css/pages/TimerecordingCar/Form.css?<?= $git_merge_ts ?>" rel="stylesheet"
|
|
type="text/css"/>
|
|
<!-- 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"><?= ($timerecordingcars->id) ? "bearbeiten" : "Neu" ?></li>
|
|
|
|
</ol>
|
|
</div>
|
|
<h4 class="page-title"><?= ($timerecordingcars->id) ? "Fahrzeug bearbeiten" : "Neues Fahrzeug" ?></h4>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- end page title -->
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
|
|
<div class="card bg-light">
|
|
<div class="card-body">
|
|
<h4 class="header-title mb-2"><?= ($timerecordingcars->id) ? "Fahrzeug bearbeiten" : "Neues Fahrzeug" ?></h4>
|
|
|
|
<form class="form-horizontal" method="post"
|
|
action="<?= self::getUrl("TimerecordingCar", "save", ["returnto" => $_GET["returnto"]]) ?>">
|
|
<div class="card no-shadow">
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-lg-5">
|
|
<input type="hidden" id="id" name="id" value="<?= $timerecordingcars->id ?>"/>
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label" for="brand">Fahrzeugtyp *</label>
|
|
<div class="col-lg-4">
|
|
<select id="type_select" name="type"
|
|
class="select2 form-control" required="required">
|
|
<?php foreach ($cartypes as $key => $cartype): ?>
|
|
<option <?= ($timerecordingcars->type == $key) ? 'selected="selected"' : "" ?>
|
|
value="<?= $key ?>"><?= $cartype ?></option>
|
|
<?php
|
|
endforeach; ?>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label" for="number_plate">Kennzeichen
|
|
*</label>
|
|
<div class="col-lg-3">
|
|
<input required="required" type="text" id="number_plate"
|
|
name="number_plate"
|
|
class="form-control"
|
|
value="<?= $timerecordingcars->number_plate ?>"/>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label" for="brand">Fahrzeugverwalter</label>
|
|
<div class="col-lg-4">
|
|
<select id="user_id_select" name="user_id"
|
|
class="select2 form-control" required="required">
|
|
<option value="-"> </option>
|
|
<?php foreach ($timerecordingUsers as $key => $timerecordingUser): ?>
|
|
<option <?= ($timerecordingcars->user_id == $timerecordingUser) ? 'selected="selected"' : "" ?>
|
|
value="<?= $timerecordingUser ?>"><?= $key ?></option>
|
|
<?php
|
|
endforeach; ?>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label" for="brand">Marke *</label>
|
|
<div class="col-lg-4">
|
|
<input required="required" type="text" id="brand" name="brand"
|
|
class="form-control"
|
|
value="<?= $timerecordingcars->brand ?>"/>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label" for="model">Model/Typ *</label>
|
|
<div class="col-lg-4">
|
|
<input required="required" type="text" id="model" name="model"
|
|
class="form-control"
|
|
value="<?= $timerecordingcars->model ?>"/>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label"
|
|
for="initial_approval">Erstzulassung</label>
|
|
<div class="col-lg-3">
|
|
<input type="month" id="initial_approval"
|
|
name="initial_approval"
|
|
class="form-control"
|
|
value="<?= ($timerecordingcars->initial_approval) ? date('Y-m', $timerecordingcars->initial_approval) : "" ?>"/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label"
|
|
for="initial_approval">§57 Korrektur</label>
|
|
<div class="col-lg-3">
|
|
<input type="month" id="override_approval"
|
|
name="override_approval"
|
|
class="form-control"
|
|
value="<?= ($timerecordingcars->override_approval) ? date('Y-m', $timerecordingcars->override_approval) : "" ?>"/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label" for="first_approval">Erste §57a
|
|
nach</label>
|
|
<div class="col-lg-3">
|
|
<select id="first_approval" name="first_approval"
|
|
class="select2 form-control">
|
|
<option value=" "> </option>
|
|
<option value="1" <?= ($timerecordingcars->first_approval == "1") ? "selected='selected'" : "" ?>>
|
|
1 Jahr
|
|
</option>
|
|
<option value="2" <?= ($timerecordingcars->first_approval == "2") ? "selected='selected'" : "" ?>>
|
|
2 Jahren
|
|
</option>
|
|
<option value="3" <?= ($timerecordingcars->first_approval == "3") ? "selected='selected'" : "" ?>>
|
|
3 Jahren
|
|
</option>
|
|
<option value="4" <?= ($timerecordingcars->first_approval == "4") ? "selected='selected'" : "" ?>>
|
|
4 Jahren
|
|
</option>
|
|
<option value="5" <?= ($timerecordingcars->first_approval == "5") ? "selected='selected'" : "" ?>>
|
|
5 Jahren
|
|
</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label" for="mileage">Kilometerstand</label>
|
|
<div class="col-lg-2">
|
|
<input type="number" id="mileage" name="mileage"
|
|
class="form-control"
|
|
value="<?= $timerecordingcars->mileage ?>"/>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label"
|
|
for="timerecording">Digitales Fahrtenbuch</label>
|
|
<div class="col-lg-3">
|
|
<div class="form-check">
|
|
<input id="timerecording"
|
|
class="form-check-input" <?= ($timerecordingcars->timerecording) ? 'checked="checked"' : '' ?>
|
|
type="checkbox" name="timerecording" value="1"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-7">
|
|
<!-- <div class="form-group row">-->
|
|
<!-- <label class="col-lg-2 col-form-label" for="timerecording">Journal</label>-->
|
|
<!-- <div class="col-lg-10">-->
|
|
<!-- <textarea class="form-control eventmodal-input" id="description"-->
|
|
<!-- rows="2"></textarea>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<div id="documents" class="row mt-2 mb-2 justify-content-center">
|
|
<div class="col-6" id="ducuments" data-newkey="">
|
|
<label class="col-form-label fw-medium">Dokumente</label>
|
|
<div class="input-group mb-2">
|
|
<div class="custom-file">
|
|
<input type="file" class="custom-file-input" id="files-input"
|
|
name="files[]"
|
|
multiple>
|
|
<label class="custom-file-label" for="files-input"
|
|
aria-describedby="">Datei(en) auswählen oder
|
|
hereinziehen</label>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="attachment-div mb-2">
|
|
<?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"
|
|
data-name="<?= $timerecordingcarDokument->file->name ?>" data-id="<?= $timerecordingcarDokument->id?>">
|
|
<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="float-right"><i
|
|
title="<?= $timerecordingcarDokument->file->name ?>"
|
|
class="fas fa-trash fa-del-document ml-2"></i></span>
|
|
<span class="float-right ml-1">(<?= $uploadDate ?>)</span>
|
|
<span class="float-right"><?= $filesize ?></span>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<div class="col-lg-2 mb-1 mb-sm-1">
|
|
<?php if ($timerecordingcars->id && !$timerecordingcars->retired): ?>
|
|
<button type="button" class="btn btn-danger" data-toggle="modal"
|
|
data-target="#retireModal">
|
|
Fahrzeug ausscheiden
|
|
</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="col-lg-10">
|
|
<button type="submit" class="btn btn-primary">Speichern</button>
|
|
<a href="<?= $cancelUrl ?>">
|
|
<button type="button" class="btn btn-secondary">Abbrechen</button>
|
|
</a>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="modal fade" id="retireModal" tabindex="-1" role="dialog" aria-labelledby="retireModalLabel"
|
|
aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="retireModalLabel">Fahrzeug ausscheiden</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<label for="retireDate">Bitte Datum auswählen:</label>
|
|
<input type="date" value="<?= date("Y-m-d", time()) ?>" id="retireDate" class="form-control">
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-danger" id="confirmRetire">Fahrzeug ausscheiden</button>
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
let requestDocumentUrl = "<?= self::getUrl("File", "download") ?>";
|
|
let requestDocumentUploadUrl = "<?= self::getUrl("TimerecordingCar", "api", ['do' => 'uploadDocuments']) ?>";
|
|
let requestDocumentDeleteUrl = "<?= self::getUrl("TimerecordingCar", "api", ['do' => 'deleteDocument']) ?>";
|
|
</script>
|
|
<script type="text/javascript"
|
|
src="<?= self::getResourcePath() ?>plugins/tinymce/tinymce.min.js?<?= $git_merge_ts ?>"></script>
|
|
<script type="text/javascript"
|
|
src="<?= self::getResourcePath() ?>js/pages/TimerecordingCar/Form.js?<?= $git_merge_ts ?>"></script>
|
|
|
|
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|