Status labels (#4895)

* fix statuslabels

* fix statuslabels
This commit is contained in:
vcordes79 2018-01-24 03:08:54 +01:00 committed by snipe
parent c75a2051ff
commit f4e9d245d0
3 changed files with 16 additions and 12 deletions

View file

@ -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,

View file

@ -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 '<i class="fa fa-barcode"></i>';
}
}

View file

@ -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 = '<label class="label label-default">{{ trans('general.deployed') }}</label>';
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 '<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>';
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + value.id + '" data-tooltip="true" title="'+ status_meta[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>';
}