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

@ -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 '<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>';
}
@ -327,7 +332,7 @@
return '<a href="{{ url('/') }}/' + destination + '/' + row.assigned_pivot_id + '/checkin" class="btn btn-sm bg-purple" data-tooltip="true" title="Check this item in so it is available for re-imaging, re-issue, etc.">{{ trans('general.checkin') }}</a>';
}
}
}
}
@ -525,7 +530,7 @@
}, 0);
return total_sum.toFixed(2);
}
$(function () {
$('#bulkEdit').click(function () {