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
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
<?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()));
|
||||
@@ -9,9 +13,13 @@ if ($firstApproval < time()) {
|
||||
}
|
||||
}
|
||||
$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;
|
||||
@@ -44,73 +52,132 @@ $approval = date("m/Y", $firstApproval);
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-5 card-border">
|
||||
<div>
|
||||
<h4>Fahrzeug Informationen </h4>
|
||||
<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>
|
||||
<table class="table table-sm">
|
||||
<tbody>
|
||||
<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>
|
||||
<div class="col-12 col-lg-5 card-border">
|
||||
<div>
|
||||
<h4> </h4>
|
||||
|
||||
<?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>
|
||||
<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>
|
||||
<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>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -158,7 +225,8 @@ $approval = date("m/Y", $firstApproval);
|
||||
<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->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>
|
||||
|
||||
@@ -8,8 +8,13 @@ foreach ($timerecordingusers as $timerecordinguser) {
|
||||
$timerecordingUsers[$timerecordinguser->name] = $timerecordinguser->id;
|
||||
}
|
||||
ksort($timerecordingUsers);
|
||||
|
||||
$cartypes = TimerecordingCarModel::$carTypes;
|
||||
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
|
||||
<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">
|
||||
@@ -41,106 +46,210 @@ ksort($timerecordingUsers);
|
||||
action="<?= self::getUrl("TimerecordingCar", "save", ["returnto" => $_GET["returnto"]]) ?>">
|
||||
<div class="card no-shadow">
|
||||
<div class="card-body">
|
||||
<input type="hidden" name="id" value="<?= $timerecordingcars->id ?>"/>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="number_plate">Kennzeichen *</label>
|
||||
<div class="col-lg-1">
|
||||
<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-2 col-form-label" for="brand">Fahrzeugverwalter</label>
|
||||
<div class="col-lg-2">
|
||||
<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 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-2 col-form-label" for="brand">Marke *</label>
|
||||
<div class="col-lg-3">
|
||||
<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-2 col-form-label" for="model">Model/Typ *</label>
|
||||
<div class="col-lg-3">
|
||||
<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-2 col-form-label" for="initial_approval">Erstzulassung</label>
|
||||
<div class="col-lg-2">
|
||||
<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>
|
||||
<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 class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="first_approval">Erste §57a nach</label>
|
||||
<div class="col-lg-2">
|
||||
<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 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>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="mileage">Kilometerstand</label>
|
||||
<div class="col-lg-1">
|
||||
<input type="number" id="mileage" name="mileage"
|
||||
class="form-control"
|
||||
value="<?= $timerecordingcars->mileage ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 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 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">
|
||||
<label class="col-lg-2"></label>
|
||||
<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>
|
||||
|
||||
@@ -151,19 +260,35 @@ ksort($timerecordingUsers);
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(".select2").select2({placeholder: ""});
|
||||
|
||||
// disable mousewheel on a input number field when in focus
|
||||
$('form').on('focus', 'input[type=number]', function (e) {
|
||||
$(this).on('wheel.disableScroll', function (e) {
|
||||
e.preventDefault()
|
||||
})
|
||||
});
|
||||
$('form').on('blur', 'input[type=number]', function (e) {
|
||||
$(this).off('wheel.disableScroll')
|
||||
});
|
||||
<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"); ?>
|
||||
@@ -1,12 +1,30 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= $git_merge_ts ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<link href="<?= self::getResourcePath() ?>datatables/DataTables-2x/datatables.min.css?<?= $git_merge_ts ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<style>
|
||||
table.dataTable.table-sm > thead > tr > th:not(.sorting_disabled) {
|
||||
padding-right: 10px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
.retired {
|
||||
background-color: #780000 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.retired-href {
|
||||
color: #cfe6ff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.retired-href:hover {
|
||||
color: #ffffff;
|
||||
|
||||
}
|
||||
|
||||
.text-underlined {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
@@ -39,88 +57,395 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-striped table-hover table-sm">
|
||||
<thead>
|
||||
<tr class="bg-white">
|
||||
<th class="text-center">Kennzeichen</th>
|
||||
<th class="text-center">Fahrzeugverwalter</th>
|
||||
<th class="text-center">Marke</th>
|
||||
<th class="text-center">Model/Typ</th>
|
||||
<th class="text-center">Erstzulassssung</th>
|
||||
<th class="text-center">$57a</th>
|
||||
<th class="text-center">Fahrtenbuch</th>
|
||||
<th class="text-center">Kilometerstand</th>
|
||||
<th class="edit-width-w70"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordingcars as $timerecordingcar):
|
||||
$initialApproval = date("Y-m-d H:i:s", $timerecordingcar->initial_approval);
|
||||
$initialApprovalMonth = date("m", $timerecordingcar->initial_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);
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a
|
||||
class="nav-link active"
|
||||
id="home-tab"
|
||||
data-toggle="tab"
|
||||
href="#home"
|
||||
role="tab"
|
||||
aria-controls="home"
|
||||
aria-selected="true"
|
||||
>PKW's</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a
|
||||
class="nav-link"
|
||||
id="profile-tab"
|
||||
data-toggle="tab"
|
||||
href="#user-tab"
|
||||
role="tab"
|
||||
aria-controls="user-tab"
|
||||
aria-selected="false"
|
||||
>Anhänger</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div
|
||||
class="tab-pane fade show active"
|
||||
id="home"
|
||||
role="tabpanel"
|
||||
aria-labelledby="home-tab"
|
||||
>
|
||||
<table id="datatable" class="table table-striped table-hover table-sm">
|
||||
<thead>
|
||||
<tr class="bg-white">
|
||||
<th class="text-center">Kennzeichen</th>
|
||||
<th class="text-center">Fahrzeugverwalter</th>
|
||||
<th class="text-center">Marke</th>
|
||||
<th class="text-center">Model/Typ</th>
|
||||
<th class="text-center">Erstzulassung</th>
|
||||
<th class="text-center">$57a</th>
|
||||
<th class="text-center">Fahrtenbuch</th>
|
||||
<th class="text-center">KM-Stand</th>
|
||||
<th class="text-center">Aktiv</th>
|
||||
<th class="edit-width-w70"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordingcars as $timerecordingcar):
|
||||
if ($timerecordingcar->type == 2) {
|
||||
continue;
|
||||
}
|
||||
$initialApproval = date("Y-m-d H:i:s", $timerecordingcar->initial_approval);
|
||||
$initialApprovalMonth = date("m", $timerecordingcar->initial_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);
|
||||
|
||||
?>
|
||||
<tr class="<?= ($timerecordingcar->retired) ? 'retired' : '' ?>">
|
||||
<td>
|
||||
<a class="<?= ($timerecordingcar->retired) ? 'retired-href' : 'text-underlined' ?>"
|
||||
href="<?= self::getUrl("TimerecordingCar", "detail", ["id" => $timerecordingcar->id]) ?>"> <?= $timerecordingcar->number_plate ?></a>
|
||||
</td>
|
||||
<td><?= ($timerecordingcar->user_id) ? $timerecordingcar->user->name : "-" ?></td>
|
||||
<td><?= $timerecordingcar->brand ?></td>
|
||||
<td><?= $timerecordingcar->model ?></td>
|
||||
<td class="text-center"
|
||||
data-order="<?= ($timerecordingcar->initial_approval) ? $timerecordingcar->initial_approval : "-" ?>"><?= ($timerecordingcar->initial_approval) ? date("m/Y", $timerecordingcar->initial_approval) : "-" ?></td>
|
||||
<td class="text-center"
|
||||
data-order="<?= ($timerecordingcar->initial_approval) ? $firstApproval : "-" ?>"><?= ($timerecordingcar->initial_approval) ? $approval : "-" ?></td>
|
||||
<td class="text-center"><?= ($timerecordingcar->timerecording) ? "Ja" : "Nein" ?></td>
|
||||
<td class="text-center"><?= ($timerecordingcar->mileage_now) ? number_format($timerecordingcar->mileage_now, 0, ',', '.') . " KM" : "-" ?>
|
||||
<td class="text-center"><?= ($timerecordingcar->retired) ? "Nein" : "Ja" ?></td>
|
||||
</td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?= self::getUrl("TimerecordingCar", "edit", ["id" => $timerecordingcar->id]) ?>"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?= self::getUrl("TimerecordingCar", "delete", ["id" => $timerecordingcar->id]) ?>"
|
||||
onclick="if(!confirm('Fahrzeug 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
|
||||
class="tab-pane fade col-12"
|
||||
id="user-tab"
|
||||
role="tabpanel"
|
||||
aria-labelledby="profile-tab"
|
||||
>
|
||||
<table id="datatable2" class="table table-striped table-hover table-sm" style="width:100%">
|
||||
<thead>
|
||||
<tr class="bg-white">
|
||||
<th class="text-center">Kennzeichen</th>
|
||||
<th class="text-center">Fahrzeugverwalter</th>
|
||||
<th class="text-center">Marke</th>
|
||||
<th class="text-center">Model/Typ</th>
|
||||
<th class="text-center">Erstzulassung</th>
|
||||
<th class="text-center">$57a</th>
|
||||
<th class="text-center">Fahrtenbuch</th>
|
||||
<th class="text-center">KM-Stand</th>
|
||||
<th class="text-center">Aktiv</th>
|
||||
<th class="edit-width-w70"></th>
|
||||
</tr>
|
||||
<tr id="filterrow2">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordingcars as $timerecordingcar):
|
||||
if ($timerecordingcar->type == 1) {
|
||||
continue;
|
||||
}
|
||||
$initialApproval = date("Y-m-d H:i:s", $timerecordingcar->initial_approval);
|
||||
$initialApprovalMonth = date("m", $timerecordingcar->initial_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);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a class="<?= ($timerecordingcar->retired) ? 'retired-href' : 'text-underlined' ?>"
|
||||
href="<?= self::getUrl("TimerecordingCar", "detail", ["id" => $timerecordingcar->id]) ?>"> <?= $timerecordingcar->number_plate ?></a>
|
||||
</td>
|
||||
<td><?= ($timerecordingcar->user_id) ? $timerecordingcar->user->name : "-" ?></td>
|
||||
<td><?= $timerecordingcar->brand ?></td>
|
||||
<td><?= $timerecordingcar->model ?></td>
|
||||
<td class="text-center"
|
||||
data-order="<?= ($timerecordingcar->initial_approval) ? $timerecordingcar->initial_approval : "-" ?>"><?= ($timerecordingcar->initial_approval) ? date("m/Y", $timerecordingcar->initial_approval) : "-" ?></td>
|
||||
<td class="text-center"
|
||||
data-order="<?= ($timerecordingcar->initial_approval) ? $firstApproval : "-" ?>"><?= ($timerecordingcar->initial_approval) ? $approval : "-" ?></td>
|
||||
<td class="text-center"><?= ($timerecordingcar->timerecording) ? "Ja" : "Nein" ?></td>
|
||||
<td class="text-center"><?= ($timerecordingcar->mileage_now) ? number_format($timerecordingcar->mileage_now, 0, ',', '.') . " KM" : "-" ?>
|
||||
<td class="text-center"><?= ($timerecordingcar->retired) ? "Nein" : "Ja" ?></td>
|
||||
</td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?= self::getUrl("TimerecordingCar", "edit", ["id" => $timerecordingcar->id]) ?>"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?= self::getUrl("TimerecordingCar", "delete", ["id" => $timerecordingcar->id]) ?>"
|
||||
onclick="if(!confirm('Fahrzeug 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>
|
||||
<h3></h3>
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?= self::getUrl("TimerecordingCar", "detail", ["id" => $timerecordingcar->id]) ?>"> <?= $timerecordingcar->number_plate ?></a>
|
||||
</td>
|
||||
<td><?= ($timerecordingcar->user_id) ? $timerecordingcar->user->name : "-" ?></td>
|
||||
<td><?= $timerecordingcar->brand ?></td>
|
||||
<td><?= $timerecordingcar->model ?></td>
|
||||
<td class="text-center"><?= ($timerecordingcar->initial_approval) ? date("m/Y", $timerecordingcar->initial_approval) : "-" ?></td>
|
||||
<td class="text-center"><?= ($timerecordingcar->initial_approval) ? $approval : "-" ?></td>
|
||||
<td class="text-center"><?= ($timerecordingcar->timerecording) ? "Ja" : "Nein" ?></td>
|
||||
<td class="text-center"><?= ($timerecordingcar->mileage_now) ? number_format($timerecordingcar->mileage_now, 0, ',', '.')." KM" : "-" ?>
|
||||
</td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?= self::getUrl("TimerecordingCar", "edit", ["id" => $timerecordingcar->id]) ?>"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?= self::getUrl("TimerecordingCar", "delete", ["id" => $timerecordingcar->id]) ?>"
|
||||
onclick="if(!confirm('Fahrzeug 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"
|
||||
src="<?= self::getResourcePath() ?>datatables/DataTables-2x/datatables.min.js?<?= $git_merge_ts ?>"></script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [8];
|
||||
let table, table2;
|
||||
let tableInitialized = false;
|
||||
// Variablen definieren, die du ggf. anpassen musst:
|
||||
let hidesearchDT = [7, 9];
|
||||
|
||||
var columnfilter = [6];
|
||||
var columnoptions = '<option value=""></option><option value="Ja">Ja</option><option value="Nein">Nein</option>';
|
||||
$(document).ready(function () {
|
||||
let pageLength = 25;
|
||||
let cstmdom = "flBrtip";
|
||||
let columndefs = [];
|
||||
let columnfilter = [6, 8];
|
||||
let columnoptions = '<option value=""></option><option value="Ja">Ja</option><option value="Nein">Nein</option>';
|
||||
|
||||
// Initialisierung für die erste Tabelle (z. B. PKW's)
|
||||
$('#filterrow th').each(function (i) {
|
||||
let title = $('#datatable thead th').eq(i).text();
|
||||
if (hidesearchDT.includes(i)) {
|
||||
// Kein Filter hinzufügen
|
||||
} else if (columnfilter.includes(i)) {
|
||||
if (i === 8) {
|
||||
$(this).html('<select id="selectsearch" style="padding: 0; height: 28px; text-align: center;" class="form-control" data-index="' + i + '"><option value=""></option><option selected="selected" value="Ja">Ja</option><option value="Nein">Nein</option></select>');
|
||||
} else {
|
||||
$(this).html('<select style="padding: 0; height: 28px; text-align: center;" class="form-control" data-index="' + i + '">' + columnoptions + '</select>');
|
||||
}
|
||||
} else {
|
||||
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
|
||||
}
|
||||
});
|
||||
|
||||
table = $('#datatable').DataTable({
|
||||
responsive: {
|
||||
breakpoints: [
|
||||
{name: 'desktop', width: Infinity},
|
||||
{name: 'tablet', width: 1024},
|
||||
{name: 'fablet', width: 768},
|
||||
{name: 'phone', width: 480}
|
||||
]
|
||||
},
|
||||
pageLength: pageLength,
|
||||
buttons: [{
|
||||
extend: 'excelHtml5',
|
||||
text: 'XLSX Export',
|
||||
className: 'btn-success d-none margina d-lg-block',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)',
|
||||
format: {
|
||||
body: function (data) {
|
||||
data = $('<p>' + data + '</p>').text();
|
||||
return $.isNumeric(data.replace(',', '.')) ? data.replace(',', '.') : data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
columnDefs: columndefs,
|
||||
language: {"url": "/datatables/json/german.json?v1"},
|
||||
orderCellsTop: true,
|
||||
stateSave: true,
|
||||
stateDuration: 60 * 60 * 24 * 30,
|
||||
stateLoadParams: function (settings, data) {
|
||||
data.order = [[2, 'asc'], [1, 'asc']];
|
||||
},
|
||||
initComplete: function () {
|
||||
$('#datatable_filter').append('<i id="clear_cookie" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true"></i>');
|
||||
$('#clear_cookie').click(function () {
|
||||
$('#filterrow input').val('');
|
||||
$('#filterrow select').val('');
|
||||
table.search('').columns().search('').draw();
|
||||
});
|
||||
$('#selectsearch').change();
|
||||
},
|
||||
dom: cstmdom
|
||||
});
|
||||
|
||||
$('#filterrow').on('keyup', 'input', function () {
|
||||
table
|
||||
.column($(this).data('index'))
|
||||
.search(this.value)
|
||||
.draw();
|
||||
});
|
||||
|
||||
$('#filterrow').on('change', 'select', function () {
|
||||
table
|
||||
.column($(this).data('index'))
|
||||
.search(this.value)
|
||||
.draw();
|
||||
});
|
||||
let state = table.state.loaded();
|
||||
if (state) {
|
||||
table.columns().eq(0).each(function (colIdx) {
|
||||
var colSearch = state.columns[colIdx].search;
|
||||
|
||||
if (colSearch.search) {
|
||||
|
||||
if (colIdx == 8) {
|
||||
|
||||
} else {
|
||||
$('#filterrow').find("[data-index='" + colIdx + "']").val(colSearch.search);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
table.draw();
|
||||
}
|
||||
|
||||
|
||||
// Initialisierung für die zweite Tabelle (z. B. Anhänger)
|
||||
$('#filterrow2 th').each(function (i) {
|
||||
let title = $('#datatable2 thead th').eq(i).text();
|
||||
if (hidesearchDT.includes(i)) {
|
||||
// Kein Filter
|
||||
} else if (columnfilter.includes(i)) {
|
||||
if (i === 8) {
|
||||
$(this).html('<select id="selectsearch2" style="padding: 0; height: 28px; text-align: center;" class="form-control" data-index="' + i + '"><option value=""></option><option selected="selected" value="Ja">Ja</option><option value="Nein">Nein</option></select>');
|
||||
} else {
|
||||
$(this).html('<select style="padding: 0; height: 28px; text-align: center;" class="form-control" data-index="' + i + '">' + columnoptions + '</select>');
|
||||
}
|
||||
|
||||
} else {
|
||||
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
|
||||
}
|
||||
});
|
||||
|
||||
table2 = $('#datatable2').DataTable({
|
||||
responsive: {
|
||||
breakpoints: [
|
||||
{name: 'desktop', width: Infinity},
|
||||
{name: 'tablet', width: 1024},
|
||||
{name: 'fablet', width: 768},
|
||||
{name: 'phone', width: 480}
|
||||
]
|
||||
},
|
||||
pageLength: pageLength,
|
||||
buttons: [{
|
||||
extend: 'excelHtml5',
|
||||
text: 'XLSX Export',
|
||||
className: 'btn-success d-none margina d-lg-block',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)',
|
||||
format: {
|
||||
body: function (data) {
|
||||
data = $('<p>' + data + '</p>').text();
|
||||
return $.isNumeric(data.replace(',', '.')) ? data.replace(',', '.') : data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
columnDefs: columndefs,
|
||||
language: {"url": "/datatables/json/german.json?v1"},
|
||||
orderCellsTop: true,
|
||||
stateSave: true,
|
||||
stateDuration: 60 * 60 * 24 * 30,
|
||||
stateLoadParams: function (settings, data) {
|
||||
data.order = [[2, 'asc'], [1, 'asc']];
|
||||
},
|
||||
initComplete: function () {
|
||||
$('#datatable2_filter').append('<i id="clear_cookie2" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true"></i>');
|
||||
$('#clear_cookie2').click(function () {
|
||||
$('#filterrow2 input').val('');
|
||||
$('#filterrow2 select').val('');
|
||||
table2.search('').columns().search('').draw();
|
||||
});
|
||||
$('#selectsearch2').change();
|
||||
},
|
||||
dom: cstmdom
|
||||
});
|
||||
|
||||
$('#filterrow2').on('keyup', 'input', function () {
|
||||
table2
|
||||
.column($(this).data('index'))
|
||||
.search(this.value)
|
||||
.draw();
|
||||
});
|
||||
|
||||
$('#filterrow2').on('change', 'select', function () {
|
||||
table2
|
||||
.column($(this).data('index'))
|
||||
.search(this.value)
|
||||
.draw();
|
||||
});
|
||||
let state2 = table2.state.loaded();
|
||||
if (state2) {
|
||||
table2.columns().eq(0).each(function (colIdx) {
|
||||
var colSearch = state2.columns[colIdx].search;
|
||||
if (colIdx == 8) {
|
||||
|
||||
} else {
|
||||
$('#filterrow2').find("[data-index='" + colIdx + "']").val(colSearch.search);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
table2.draw();
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std2.js?<?= $git_merge_ts ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
Reference in New Issue
Block a user