From 011726154c7dbf4e2d964682a01ad724a734a0ab Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Thu, 29 Jun 2023 03:16:59 -0600 Subject: [PATCH 1/4] Set rtd_location if a location is given at checkin --- app/Http/Controllers/Assets/AssetCheckinController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Assets/AssetCheckinController.php b/app/Http/Controllers/Assets/AssetCheckinController.php index 657b02171..fa4fd52e7 100644 --- a/app/Http/Controllers/Assets/AssetCheckinController.php +++ b/app/Http/Controllers/Assets/AssetCheckinController.php @@ -94,14 +94,15 @@ class AssetCheckinController extends Controller \Log::debug('Manually override the location IDs'); \Log::debug('Original Location ID: '.$asset->location_id); $asset->location_id = ''; - \Log::debug('New RTD Location ID: '.$asset->location_id); + \Log::debug('New Location ID: '.$asset->location_id); } $asset->location_id = $asset->rtd_location_id; if ($request->filled('location_id')) { \Log::debug('NEW Location ID: '.$request->get('location_id')); - $asset->location_id = e($request->get('location_id')); + $asset->location_id = $request->get('location_id'); + $asset->rtd_location_id = $request->get('location_id'); } $checkin_at = date('Y-m-d H:i:s'); From 743e852998b5add55e3e1bab4832a3a36cee4f85 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Thu, 6 Jul 2023 10:38:48 -0600 Subject: [PATCH 2/4] Add radio buttons to alter asset checkin location behavior --- .../Controllers/Assets/AssetCheckinController.php | 1 - .../partials/forms/edit/location-select.blade.php | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Assets/AssetCheckinController.php b/app/Http/Controllers/Assets/AssetCheckinController.php index fa4fd52e7..da4ebb912 100644 --- a/app/Http/Controllers/Assets/AssetCheckinController.php +++ b/app/Http/Controllers/Assets/AssetCheckinController.php @@ -102,7 +102,6 @@ class AssetCheckinController extends Controller if ($request->filled('location_id')) { \Log::debug('NEW Location ID: '.$request->get('location_id')); $asset->location_id = $request->get('location_id'); - $asset->rtd_location_id = $request->get('location_id'); } $checkin_at = date('Y-m-d H:i:s'); diff --git a/resources/views/partials/forms/edit/location-select.blade.php b/resources/views/partials/forms/edit/location-select.blade.php index 719370fe7..cdc4bcf67 100644 --- a/resources/views/partials/forms/edit/location-select.blade.php +++ b/resources/views/partials/forms/edit/location-select.blade.php @@ -30,6 +30,21 @@ @endif + +
+
+ + + +
+
+ From 9591442f1e4ab557dfa5cfb1941e4dc1a6652ee8 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Thu, 6 Jul 2023 10:46:21 -0600 Subject: [PATCH 3/4] Evaluate the radio input to update location only or default location too --- app/Http/Controllers/Assets/AssetCheckinController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/Assets/AssetCheckinController.php b/app/Http/Controllers/Assets/AssetCheckinController.php index da4ebb912..fd5cee30e 100644 --- a/app/Http/Controllers/Assets/AssetCheckinController.php +++ b/app/Http/Controllers/Assets/AssetCheckinController.php @@ -102,6 +102,10 @@ class AssetCheckinController extends Controller if ($request->filled('location_id')) { \Log::debug('NEW Location ID: '.$request->get('location_id')); $asset->location_id = $request->get('location_id'); + + if ($request->get('update_default_location') == 0){ + $asset->rtd_location_id = $request->get('location_id'); + } } $checkin_at = date('Y-m-d H:i:s'); From f4ca29b4a81ded7beb2080c5d0ede01100920ac9 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Thu, 6 Jul 2023 11:36:55 -0600 Subject: [PATCH 4/4] Only show radio inputs for location in checkin view --- resources/views/hardware/checkin.blade.php | 2 +- .../forms/edit/location-select.blade.php | 30 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/resources/views/hardware/checkin.blade.php b/resources/views/hardware/checkin.blade.php index f7fe067c8..dd6237b1b 100755 --- a/resources/views/hardware/checkin.blade.php +++ b/resources/views/hardware/checkin.blade.php @@ -73,7 +73,7 @@ - @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id', 'help_text' => ($asset->defaultLoc) ? 'You can choose to check this asset in to a location other than the default location of '.$asset->defaultLoc->name.' if one is set.' : null]) + @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id', 'help_text' => ($asset->defaultLoc) ? 'You can choose to check this asset in to a location other than the default location of '.$asset->defaultLoc->name.' if one is set.' : null, 'hide_location_radio' => true])
diff --git a/resources/views/partials/forms/edit/location-select.blade.php b/resources/views/partials/forms/edit/location-select.blade.php index cdc4bcf67..c0ce9f9b8 100644 --- a/resources/views/partials/forms/edit/location-select.blade.php +++ b/resources/views/partials/forms/edit/location-select.blade.php @@ -30,21 +30,21 @@
@endif - -
-
- - - -
-
- + @if (isset($hide_location_radio)) + +
+
+ + +
+
+ @endif