More UI tweaking for meta statuses

This commit is contained in:
snipe 2017-09-29 15:24:33 -07:00
parent 2ea91266c0
commit 43ff66e4d9
3 changed files with 25 additions and 3 deletions

View file

@ -33,7 +33,7 @@ class AssetsTransformer
'model_number' => ($asset->model) ? e($asset->model->model_number) : null,
'status_label' => ($asset->assetstatus) ? [
'id' => (int) $asset->assetstatus->id,
'name'=> e($asset->assetstatus->name),
'name'=> e($asset->present()->statusText),
'status_meta' => e($asset->present()->statusMeta),
] : null,
'category' => ($asset->model->category) ? [

View file

@ -346,7 +346,7 @@ class AssetPresenter extends Presenter
public function statusText()
{
if ($this->model->assignedTo) {
return strtolower(trans('general.deployed'));
return trans('general.deployed');
}
return $this->model->assetstatus->name;
}

View file

@ -140,7 +140,29 @@ $('.snipe-table').bootstrapTable({
function genericColumnObjLinkFormatter(destination) {
return function (value,row) {
if ((value) && (value.status_meta)) {
return '<label class="label label-default">'+ value.status_meta + '</label> <a href="{{ url('/') }}/' + destination + '/' + value.id + '"> ' + value.name + '</a> ';
var text_color;
var icon_style;
switch (value.status_meta) {
case 'deployed':
text_color = 'blue';
icon_style = 'fa-circle';
break;
case 'deployable':
text_color = 'green';
icon_style = 'fa-circle';
break;
case 'pending':
text_color = 'orange';
icon_style = 'fa-circle';
break;
default:
text_color = 'red';
icon_style = 'fa-times';
}
return '<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> ';
} else if ((value) && (value.name)) {
return '<a href="{{ url('/') }}/' + destination + '/' + value.id + '"> ' + value.name + '</a>';
}