From e6131cda88c3e3d84ae6bbce380fcc6794976cb4 Mon Sep 17 00:00:00 2001 From: Daniel Spitzer Date: Mon, 10 Mar 2025 14:32:45 +0100 Subject: [PATCH] =?UTF-8?q?Zeiterfassung=20neues=20Feature:=20Features=20f?= =?UTF-8?q?=C3=BCr=20Project=207832:=20*=20Das=20Pickerldatum=20Zusatzfeld?= =?UTF-8?q?=20*=20Auftrennen=20PKW=20und=20Anh=C3=A4nger=20*=20Dokumente?= =?UTF-8?q?=20Upload=20*=20Standardsortierung=20*=20Ausgeschieden=20Flag?= =?UTF-8?q?=20mit=20Datum=20*=20zus=C3=A4tzliche=20migration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Layout/default/TimerecordingCar/Detail.php | 86 ++++++++++--------- Layout/default/TimerecordingCar/Form.php | 25 ++++-- Layout/default/TimerecordingCar/Index.php | 30 +++++-- .../TimerecordingCarController.php | 9 ++ public/js/pages/TimerecordingCar/Form.js | 3 +- 5 files changed, 93 insertions(+), 60 deletions(-) diff --git a/Layout/default/TimerecordingCar/Detail.php b/Layout/default/TimerecordingCar/Detail.php index 15bd2861d..411966afc 100644 --- a/Layout/default/TimerecordingCar/Detail.php +++ b/Layout/default/TimerecordingCar/Detail.php @@ -41,10 +41,16 @@ $cartypes = TimerecordingCarModel::$carTypes;

brand . "/" . $timerecordingcar->model . " (" . $timerecordingcar->number_plate . ")" ?> Detail - $timerecordingcar->id, 'returnto' => "detail"]) ?>"> + "> + + + + + $timerecordingcar->id, 'returnto' => "detail", 'hash' => $_GET['hash']]) ?>"> +

@@ -58,7 +64,7 @@ $cartypes = TimerecordingCarModel::$carTypes;
-
+

Fahrzeug Informationen

retired_date): ?>
- -
-
-
-
-
-

Dokumente

+ +
+
+
+
+
+

Dokumente

+
+ 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]; + ?> + +
- 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]; - ?> - -
-
diff --git a/Layout/default/TimerecordingCar/Form.php b/Layout/default/TimerecordingCar/Form.php index c0b4bd057..fbe2bbb43 100644 --- a/Layout/default/TimerecordingCar/Form.php +++ b/Layout/default/TimerecordingCar/Form.php @@ -1,8 +1,13 @@ $timerecordingcars->id]); +if ($_GET['hash']) { + $hash = $_GET['hash']; } else { - $cancelUrl = self::getUrl("TimerecordingCar"); + $hash = ""; +} +if (isset($_GET['returnto']) && $_GET['returnto'] == "detail") { + $cancelUrl = self::getUrl("TimerecordingCar", "Detail", ["id" => $timerecordingcars->id, "hash" => $_GET['hash']]); +} else { + $cancelUrl = self::getUrl("TimerecordingCar") . "#" . $hash; } foreach ($timerecordingusers as $timerecordinguser) { $timerecordingUsers[$timerecordinguser->name] = $timerecordinguser->id; @@ -43,7 +48,7 @@ $cartypes = TimerecordingCarModel::$carTypes;

id) ? "Fahrzeug bearbeiten" : "Neues Fahrzeug" ?>

$_GET["returnto"]]) ?>"> + action=" $_GET["returnto"], "hash" => $_GET['hash']]) ?>">
@@ -195,8 +200,8 @@ $cartypes = TimerecordingCarModel::$carTypes;
file_size; - if ($filesize<1024) { + $filesize = $timerecordingcarDokument->file_size; + if ($filesize < 1024) { $filesize = number_format($filesize, 2) . " B"; } elseif ($filesize < 1024 * 1024) { $filesize = number_format($filesize / 1024, 2) . " KB"; @@ -204,14 +209,15 @@ $cartypes = TimerecordingCarModel::$carTypes; $filesize = number_format($filesize / 1024 / 1024, 2) . " MB"; } $uploadDate = date("d.m.y", $timerecordingcarDokument->file->create); - $mimetype=$timerecordingcarDokument->file->mimetype; + $mimetype = $timerecordingcarDokument->file->mimetype; if (!array_key_exists($mimetype, $mimetypes)) { $mimetype = "fa-file"; } else $mimetype = $mimetypes[$mimetype]; ?>
+ data-name="file->name ?>" + data-id="id ?>">
@@ -225,7 +231,7 @@ $cartypes = TimerecordingCarModel::$carTypes; class="fas fa-trash fa-del-document ml-2"> () -
+
@@ -285,6 +291,7 @@ $cartypes = TimerecordingCarModel::$carTypes; let requestDocumentUrl = ""; let requestDocumentUploadUrl = " 'uploadDocuments']) ?>"; let requestDocumentDeleteUrl = " 'deleteDocument']) ?>"; + let requestRetireUrl = ""; diff --git a/Layout/default/TimerecordingCar/Index.php b/Layout/default/TimerecordingCar/Index.php index 50830625e..a54e05488 100644 --- a/Layout/default/TimerecordingCar/Index.php +++ b/Layout/default/TimerecordingCar/Index.php @@ -63,9 +63,9 @@ class="nav-link active" id="home-tab" data-toggle="tab" - href="#home" + href="#pkw" role="tab" - aria-controls="home" + aria-controls="pkw" aria-selected="true" >PKW's @@ -74,9 +74,9 @@ class="nav-link" id="profile-tab" data-toggle="tab" - href="#user-tab" + href="#anhaenger" role="tab" - aria-controls="user-tab" + aria-controls="anhaenger" aria-selected="false" >Anhänger @@ -85,11 +85,11 @@
- +
@@ -168,7 +168,7 @@
@@ -223,7 +223,7 @@
@@ -237,7 +237,7 @@
Kennzeichen
$timerecordingcar->id]) ?>"> number_plate ?> + href=" $timerecordingcar->id,"hash" => "anhaenger"]) ?>"> number_plate ?> user_id) ? $timerecordingcar->user->name : "-" ?> brand ?>retired) ? "Nein" : "Ja" ?> - $timerecordingcar->id]) ?>"> $timerecordingcar->id,"hash" => "anhaenger"]) ?>"> $timerecordingcar->id]) ?>" onclick="if(!confirm('Fahrzeug wirklich löschen?')) return false;" @@ -453,6 +453,18 @@ table2.draw(); } + $(document).ready(function() { + // Überprüfen, ob ein Hash in der URL vorhanden ist und den entsprechenden Tab aktivieren + var hash = window.location.hash; + if (hash) { + $('#myTab a[href="' + hash + '"]').tab('show'); + } + + // Beim Wechseln eines Tabs den Hash in der URL aktualisieren + $('#myTab a').on('show.bs.tab', function(e) { + window.location.hash = e.target.hash; + }); + }); diff --git a/application/TimerecordingCar/TimerecordingCarController.php b/application/TimerecordingCar/TimerecordingCarController.php index fec5c0f06..be681abec 100644 --- a/application/TimerecordingCar/TimerecordingCarController.php +++ b/application/TimerecordingCar/TimerecordingCarController.php @@ -212,7 +212,16 @@ class TimerecordingCarController extends mfBaseController $returnUrl = "TimerecordingCar"; $returnAction = "detail"; $returnVariables = array("id" => $id); + if ($this->request->hash) { + $returnVariables['hash'] = $this->request->hash; + } + } else + { + if ($this->request->hash) { + $returnAnker = $this->request->hash; + + } } TimerecordingCarModel::calcMileage(); if (!$id) { diff --git a/public/js/pages/TimerecordingCar/Form.js b/public/js/pages/TimerecordingCar/Form.js index eab8186f3..856de045c 100644 --- a/public/js/pages/TimerecordingCar/Form.js +++ b/public/js/pages/TimerecordingCar/Form.js @@ -68,8 +68,7 @@ $(document).ready(function () { alert("Bitte wählen Sie ein Datum aus."); return; } - window.location.href = " $timerecordingcars->id]) ?>" - + "&retired_date=" + encodeURIComponent(retireDate); + window.location.href = requestRetireUrl + "?id=" + $('#id').val() + "&retired_date=" + encodeURIComponent(retireDate); }); $('body').on('change', '#files-input', function () { let fileList = $('#files-input').prop("files");