From a0cbf66c815303434f4e91e80e6fbd6a59651f95 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 28 Feb 2024 14:59:20 +0000 Subject: [PATCH 1/5] Only show tabs if there are requestable assets/models Signed-off-by: snipe --- .../account/requestable-assets.blade.php | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/resources/views/account/requestable-assets.blade.php b/resources/views/account/requestable-assets.blade.php index 8e3c08fd571b..89e027fdc125 100644 --- a/resources/views/account/requestable-assets.blade.php +++ b/resources/views/account/requestable-assets.blade.php @@ -16,20 +16,37 @@
+ + @if (($assets->count() < 1) && ($models->count() < 1)) + +
+
+ + {{ trans('general.notification_info') }}: + {{ trans('general.no_requestable') }} +
+
+ + @else -
+ @endif -
+ @if ($models->count() > 0) +
- - @if ($models->count() > 0)

{{ trans('general.requestable_models') }}

- @else -
- - {{ trans('general.no_results') }} -
- @endif
+ @endif
+ + @endif @stop From 1ce9df7998e4920854bb3c19c26412dd50b28f2b Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 28 Feb 2024 14:59:27 +0000 Subject: [PATCH 2/5] New translation Signed-off-by: snipe --- resources/lang/en-US/general.php | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lang/en-US/general.php b/resources/lang/en-US/general.php index fd26aaee5e35..f7fb41743e0e 100644 --- a/resources/lang/en-US/general.php +++ b/resources/lang/en-US/general.php @@ -516,5 +516,6 @@ 'partial' => 'Deleted :success_count :object_type, but :error_count :object_type could not be deleted', ], ], + 'no_requestable' => 'There are no requestable assets or asset models.', ]; From 7c3d8b896bb1b30a31443d7db0266d1ca7556da6 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 28 Feb 2024 14:59:55 +0000 Subject: [PATCH 3/5] Updated asset transformers/presenters to display requestable status Signed-off-by: snipe --- app/Http/Controllers/Api/AssetsController.php | 1 + app/Http/Transformers/AssetsTransformer.php | 1 + app/Presenters/AssetPresenter.php | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 7482c03f17f5..d9e9a2190f70 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -111,6 +111,7 @@ public function index(Request $request, $audit = null) 'requests_counter', 'byod', 'asset_eol_date', + 'requestable', ]; $filter = []; diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index f5d5ae12b5a5..b9191d2e6394 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -37,6 +37,7 @@ public function transformAsset(Asset $asset) 'name'=> e($asset->model->name), ] : null, 'byod' => ($asset->byod ? true : false), + 'requestable' => ($asset->requestable ? true : false), 'model_number' => (($asset->model) && ($asset->model->model_number)) ? e($asset->model->model_number) : null, 'eol' => (($asset->asset_eol_date != '') && ($asset->purchase_date != '')) ? Carbon::parse($asset->asset_eol_date)->diffInMonths($asset->purchase_date).' months' : null, diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index de7c2c77097c..dd88b07fdef4 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -195,6 +195,14 @@ public static function dataTableLayout() 'visible' => false, 'title' => trans('admin/hardware/form.warranty_expires'), 'formatter' => 'dateDisplayFormatter', + ], [ + 'field' => 'requestable', + 'searchable' => false, + 'sortable' => true, + 'visible' => false, + 'title' => trans('admin/hardware/general.requestable'), + 'formatter' => 'trueFalseFormatter', + ], [ 'field' => 'notes', 'searchable' => true, From 658dda916c0c264812ae210f15db307e48c3f64c Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 28 Feb 2024 15:01:00 +0000 Subject: [PATCH 4/5] Changed operator Signed-off-by: snipe --- resources/views/account/requestable-assets.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/account/requestable-assets.blade.php b/resources/views/account/requestable-assets.blade.php index 89e027fdc125..a38fb1e1fd88 100644 --- a/resources/views/account/requestable-assets.blade.php +++ b/resources/views/account/requestable-assets.blade.php @@ -99,7 +99,7 @@ class="table table-striped snipe-table" @endif @if ($models->count() > 0) -
+

{{ trans('general.requestable_models') }}

From 3da47cdacddbb5c6a7092a76729d5aaab552d771 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 28 Feb 2024 15:03:34 +0000 Subject: [PATCH 5/5] Removed header for consistency Signed-off-by: snipe --- resources/views/account/requestable-assets.blade.php | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/views/account/requestable-assets.blade.php b/resources/views/account/requestable-assets.blade.php index a38fb1e1fd88..752be571f423 100644 --- a/resources/views/account/requestable-assets.blade.php +++ b/resources/views/account/requestable-assets.blade.php @@ -102,7 +102,6 @@ class="table table-striped snipe-table"
-

{{ trans('general.requestable_models') }}