A free open source IT asset/license management system
Tweaked checkin/checkout button statuses
snipebec443ce977b
diff --git a/app/Models/Asset.php b/app/Models/Asset.phpindex e4a953a996..19f0211fce 100644--- a/app/Models/Asset.php+++ b/app/Models/Asset.php@@ -456,6 +456,8 @@ class Asset extends Depreciablereturn true;}++ return false;}return false;@@ -465,8 +467,11 @@ class Asset extends Depreciable{// This asset is currently assigned to anyone and is not deleted...- if ($this->assigned_to) {+ if (($this->assigned_to != '') && ($this->assetstatus) && ($this->assetstatus->archived == '0')+ && ($this->assetstatus->deployable == '1')+ ) {return true;+}return false;diff --git a/app/Models/Location.php b/app/Models/Location.phpindex 954146a4ee..3abab6d714 100755--- a/app/Models/Location.php+++ b/app/Models/Location.php@@ -363,7 +363,7 @@ class Location extends SnipeModelforeach ($locations_with_children[$parent_id] as $location) {$location->use_text = $prefix.' '.$location->name;- $location->use_image = ($location->image) ? Storage::disk('public')->url('locations/' . $location->image) : null;+ $location->use_image = ($location->image) ? Storage::disk('public')->url('locations/'.$location->image) : null;$results[] = $location;// now append the children. (if we have any)if (array_key_exists($location->id, $locations_with_children)) {diff --git a/app/Models/SnipeModel.php b/app/Models/SnipeModel.phpindex e0eae999ce..ee98a58188 100644--- a/app/Models/SnipeModel.php+++ b/app/Models/SnipeModel.php@@ -247,19 +247,21 @@ class SnipeModel extends Modelif ($item->numRemaining() > 0) {return 'show-active';}+return 'show-disabled';}if (method_exists($item, 'availableForCheckout')) {- if ($item->availableForCheckout() > 0) {++ if ($item->availableForCheckout()) {return 'show-active';}+return 'show-disabled';}return false;-}public function showCheckinButton($item)@@ -268,6 +270,7 @@ class SnipeModel extends Modelif ($item->numRemaining() <= 0) {return 'show-active';}+return 'show-disabled';}@@ -275,6 +278,7 @@ class SnipeModel extends Modelif ($item->availableForCheckIn()) {return 'show-active';}+return 'show-disabled';}diff --git a/resources/views/blade/button/checkin.blade.php b/resources/views/blade/button/checkin.blade.phpindex 887263874b..f87390b1c4 100644--- a/resources/views/blade/button/checkin.blade.php+++ b/resources/views/blade/button/checkin.blade.php@@ -6,7 +6,7 @@])@can('checkin', $item)- @if ($item->showCheckinButton($item))+ @if ($item->showCheckinButton($item) == 'show-active')<a href="{{ $route }}" class="btn btn-sm bg-purple hidden-print" data-tooltip="true" data-placement="top" data-title="{{ trans('general.checkin') }}"><x-icon type="checkin" class="fa-fw" />@if ($wide=='true')diff --git a/resources/views/blade/button/checkout.blade.php b/resources/views/blade/button/checkout.blade.phpindex 44d828b44f..41c994b9b9 100644--- a/resources/views/blade/button/checkout.blade.php+++ b/resources/views/blade/button/checkout.blade.php@@ -14,7 +14,7 @@@endif</a>@elseif ($item->showCheckoutButton($item) == 'show-disabled')- <button href="#" class="btn btn-sm bg-maroon hidden-print disabled" data-tooltip="true" data-placement="top" data-title="{{ trans('general.undeployable_tooltip') }}">+ <button href="#" class="btn btn-sm bg-maroon hidden-print disabled" data-tooltip="true" data-placement="top" data-title="{{ ($item::class =='App\Models\Asset') ? trans('admin/hardware/general.undeployable_tooltip') : trans('general.undeployable_tooltip') }}"><x-icon type="checkout" class="fa-fw"/>@if ($wide=='true'){{ trans('general.checkout') }}