From 71d93ca3c38f6813c46bae77e62ab8be70944c30 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 11 Mar 2025 11:41:26 -0700 Subject: [PATCH 1/2] Use dedicated location select component Copy/paste/modify from partials.forms.edit.location-select --- .../blade/input/location-select.blade.php | 62 +++++++++++++++++++ resources/views/hardware/checkin.blade.php | 21 ++++++- 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 resources/views/blade/input/location-select.blade.php diff --git a/resources/views/blade/input/location-select.blade.php b/resources/views/blade/input/location-select.blade.php new file mode 100644 index 0000000000..3b513b95d4 --- /dev/null +++ b/resources/views/blade/input/location-select.blade.php @@ -0,0 +1,62 @@ +@use('App\Models\Location', 'Location') +@use('Illuminate\Support\Arr', 'Arr') + +@props([ + 'label', + 'name', + 'selected', + 'required' => false, + 'multiple' => false, + 'helpText' => null, + 'hideNewButton' => false, +]) + +
$errors->has($name), + ]) +> + + +
+ +
+ +
+ @unless($hideNewButton) + @can('create', Location::class) + {{ trans('button.new') }} + @endcan + @endunless +
+ + {!! $errors->first($name, '
') !!} + + @if ($helpText) +
+

{{ $helpText }}

+
+ @endif + +
diff --git a/resources/views/hardware/checkin.blade.php b/resources/views/hardware/checkin.blade.php index 5510ff89a5..fbf2aa75ce 100755 --- a/resources/views/hardware/checkin.blade.php +++ b/resources/views/hardware/checkin.blade.php @@ -95,7 +95,26 @@ - @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id', 'help_text' => ($asset->defaultLoc) ? trans('general.checkin_to_diff_location', ['default_location' => $asset->defaultLoc->name]) : null, 'hide_location_radio' => true]) + + + +
+
+ + +
+
From 18b208bba24d2c544a3198c233596bf157fa1700 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 11 Mar 2025 11:46:38 -0700 Subject: [PATCH 2/2] Account for missing location --- resources/views/blade/input/location-select.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/blade/input/location-select.blade.php b/resources/views/blade/input/location-select.blade.php index 3b513b95d4..c3c1e50b99 100644 --- a/resources/views/blade/input/location-select.blade.php +++ b/resources/views/blade/input/location-select.blade.php @@ -36,7 +36,7 @@ @if ($selected) @foreach(Arr::wrap($selected) as $id) @endforeach @endif