A free open source IT asset/license management system
Use real status label names, even if deployed
snipe6bfd428c2e5d
diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.phpindex c37a534783..76c9bd9f9d 100644--- a/app/Http/Transformers/AssetsTransformer.php+++ b/app/Http/Transformers/AssetsTransformer.php@@ -34,7 +34,8 @@ class AssetsTransformer'eol' => ($asset->purchase_date!='') ? Helper::getFormattedDateObject($asset->present()->eol_date(), 'date') : null ,'status_label' => ($asset->assetstatus) ? ['id' => (int) $asset->assetstatus->id,- 'name'=> e($asset->present()->statusText),+ 'name'=> e($asset->assetstatus->name),+ 'status_type'=> e($asset->assetstatus->getStatuslabelType()),'status_meta' => e($asset->present()->statusMeta),] : null,'category' => ($asset->model->category) ? [diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.phpindex 872e37ffea..833428b5a7 100644--- a/app/Presenters/AssetPresenter.php+++ b/app/Presenters/AssetPresenter.php@@ -417,6 +417,47 @@ class AssetPresenter extends Presenterreturn $this->model->assetstatus->name;}+ /**+ * @return string+ * This handles the status label "meta" status of "deployed" if+ * it's assigned. Results look like:+ *+ * (if assigned and the status label is "Ready to Deploy"):+ * (Deployed)+ *+ * (f assigned and status label is not "Ready to Deploy":)+ * Deployed (Another Status Label)+ *+ * (if not deployed:)+ * Another Status Label+ */+ public function fullStatusText() {+ // Make sure the status is valid+ if ($this->assetstatus) {++ // If the status is assigned to someone or something...+ if ($this->model->assigned) {++ // If it's assigned and not set to the default "ready to deploy" status+ if ($this->assetstatus->name != trans('general.ready_to_deploy')) {+ return trans('general.deployed'). ' (' . $this->model->assetstatus->name.')';+ }++ // If it's assigned to the default "ready to deploy" status, just+ // say it's deployed - otherwise it's confusing to have a status that is+ // both "ready to deploy" and deployed at the same time.+ return trans('general.deployed');+ }++ // Return just the status name+ return $this->model->assetstatus->name;+ }++ // This status doesn't seem valid - either data has been manually edited or+ // the status label was deleted.+ return 'Invalid status';+ }+/*** Date the warantee expires.* @return false|stringdiff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.phpindex 944db03b10..84002885e9 100755--- a/resources/views/hardware/view.blade.php+++ b/resources/views/hardware/view.blade.php@@ -90,7 +90,12 @@<td>@if (($asset->assignedTo) && ($asset->deleted_at==''))- <i class="fa fa-circle text-blue"></i> {{ trans('general.deployed') }} <i class="fa fa-long-arrow-right" aria-hidden="true"></i> {!! $asset->assignedTo->present()->glyph() !!}+ <i class="fa fa-circle text-blue"></i>+ {{ $asset->assetstatus->name }}+ <label class="label label-default">{{ trans('general.deployed') }}</label>++ <i class="fa fa-long-arrow-right" aria-hidden="true"></i>+ {!! $asset->assignedTo->present()->glyph() !!}{!! $asset->assignedTo->present()->nameUrl() !!}@else@if (($asset->assetstatus) && ($asset->assetstatus->deployable=='1'))@@ -555,13 +560,13 @@<!-- checked out assets table --><div class="table-responsive"><table- name="assetAssets"+ name="assetAssetsTable"data-toolbar="#toolbar"class="table table-striped snipe-table"- id="assetAssets"+ id="assetAssetsTable"data-search="false"data-url="{{route('api.assets.index',['assigned_to' => $asset->id, 'assigned_type' => 'App\Models\Asset']) }}"- data-export-options='{"fileName": "asset-assets"}'+ data-show-export="true"data-cookie="true"data-show-footer="true"data-cookie-id-table="assetAssetsTable"diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.phpindex 2bd3372c3a..47515911f5 100644--- a/resources/views/partials/bootstrap-table.blade.php+++ b/resources/views/partials/bootstrap-table.blade.php@@ -79,7 +79,6 @@@endifrefresh: 'fa-refresh'},- showExport: true,exportDataType: 'all',exportTypes: ['csv', 'excel', 'doc', 'txt','json', 'xml', 'pdf'],exportOptions: {@@ -173,26 +172,31 @@var text_color;var icon_style;+ var text_help;switch (value.status_meta) {- case 'deployed':+ case '{{ strtolower(trans('general.deployed')) }}':text_color = 'blue';icon_style = 'fa-circle';+ text_help = '<label class="label label-default">{{ trans('general.deployed') }}</label>';break;- case 'deployable':+ case '{{ strtolower(trans('admin/hardware/general.deployable')) }}':text_color = 'green';icon_style = 'fa-circle';+ text_help = '';break;- case 'pending':+ case '{{ strtolower(trans('general.pending')) }}':text_color = 'orange';icon_style = 'fa-circle';+ text_help = '';break;default:text_color = 'red';icon_style = 'fa-times';+ text_help = '';}- return '<nobr><a href="{{ url('/') }}/' + destination + '/' + value.id + '" data-tooltip="true" title="'+ value.status_meta + '"> <i class="fa ' + icon_style + ' text-' + text_color + '"></i> ' + value.name + '</a></nobr>';+ return '<nobr><a href="{{ url('/') }}/' + destination + '/' + value.id + '" data-tooltip="true" title="'+ value.status_meta + '"> <i class="fa ' + icon_style + ' text-' + text_color + '"></i> ' + value.name + ' ' + text_help + ' </a> </nobr>';} else if ((value) && (value.name)) {return '<nobr><a href="{{ url('/') }}/' + destination + '/' + value.id + '"> ' + value.name + '</a></span>';}