From f4e9d245d00d5f073023d5073de9af80201a421b Mon Sep 17 00:00:00 2001 From: vcordes79 Date: Wed, 24 Jan 2018 03:08:54 +0100 Subject: [PATCH] Status labels (#4895) * fix statuslabels * fix statuslabels --- app/Http/Transformers/AssetsTransformer.php | 2 +- app/Presenters/AssetPresenter.php | 9 ++++----- .../views/partials/bootstrap-table.blade.php | 17 +++++++++++------ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index 76c9bd9f9d..44f0b50585 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -36,7 +36,7 @@ class AssetsTransformer 'id' => (int) $asset->assetstatus->id, 'name'=> e($asset->assetstatus->name), 'status_type'=> e($asset->assetstatus->getStatuslabelType()), - 'status_meta' => e($asset->present()->statusMeta), + 'status_meta' => e($asset->present()->statusMeta), ] : null, 'category' => ($asset->model->category) ? [ 'id' => (int) $asset->model->category->id, diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index 55337ea680..3e068430f2 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -250,7 +250,7 @@ class AssetPresenter extends Presenter "visible" => true, "formatter" => "hardwareInOutFormatter", ]; - + $layout[] = [ "field" => "actions", "searchable" => false, @@ -263,7 +263,7 @@ class AssetPresenter extends Presenter return json_encode($layout); } - + /** * Generate html link to this items name. @@ -325,7 +325,7 @@ class AssetPresenter extends Presenter **/ public function name() { - + if (empty($this->model->name)) { if (isset($this->model->model)) { return $this->model->model->name.' ('.$this->model->asset_tag.')'; @@ -398,7 +398,7 @@ class AssetPresenter extends Presenter public function statusMeta() { if ($this->model->assigned) { - return strtolower(trans('general.deployed')); + return 'deployed'; } return $this->model->assetstatus->getStatuslabelType(); } @@ -482,4 +482,3 @@ class AssetPresenter extends Presenter return ''; } } - diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index c8b4c013e8..bf4c59af7c 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -175,19 +175,24 @@ var text_color; var icon_style; var text_help; + var status_meta = { + 'deployed': '{{ strtolower(trans('general.deployed')) }}', + 'deployable': '{{ strtolower(trans('admin/hardware/general.deployable')) }}', + 'pending': '{{ strtolower(trans('general.pending')) }}' + } switch (value.status_meta) { - case '{{ strtolower(trans('general.deployed')) }}': + case 'deployed': text_color = 'blue'; icon_style = 'fa-circle'; text_help = ''; break; - case '{{ strtolower(trans('admin/hardware/general.deployable')) }}': + case 'deployable': text_color = 'green'; icon_style = 'fa-circle'; text_help = ''; break; - case '{{ strtolower(trans('general.pending')) }}': + case 'pending': text_color = 'orange'; icon_style = 'fa-circle'; text_help = ''; @@ -198,7 +203,7 @@ text_help = ''; } - return ' ' + value.name + ' ' + text_help + ' '; + return ' ' + value.name + ' ' + text_help + ' '; } else if ((value) && (value.name)) { return ' ' + value.name + ''; } @@ -327,7 +332,7 @@ return '{{ trans('general.checkin') }}'; } - } + } } @@ -525,7 +530,7 @@ }, 0); return total_sum.toFixed(2); } - + $(function () { $('#bulkEdit').click(function () {