Better fix for javascript formatter for employee number

This commit is contained in:
snipe 2017-07-26 16:47:47 -07:00
parent 7d6bf4ac24
commit ee7348d0d5
2 changed files with 10 additions and 1 deletions

View file

@ -100,11 +100,12 @@ class AssetPresenter extends Presenter
"visible" => true, "visible" => true,
"formatter" => "usersLinkObjFormatter" "formatter" => "usersLinkObjFormatter"
], [ ], [
"field" => "employee_number", "field" => "assigned_to",
"searchable" => false, "searchable" => false,
"sortable" => false, "sortable" => false,
"title" => trans('admin/users/table.employee_num'), "title" => trans('admin/users/table.employee_num'),
"visible" => false, "visible" => false,
"formatter" => "employeeNumFormatter"
],[ ],[
"field" => "location", "field" => "location",

View file

@ -321,6 +321,14 @@ $('.snipe-table').bootstrapTable({
} }
} }
function employeeNumFormatter(value, row) {
if ((value) && (value.employee_number)) {
return '<a href="{{ url('/') }}/users/' + row.id + '"> ' + value.employee_number + '</a>';
} else {
return value;
}
}
function orderNumberObjFilterFormatter(value, row) { function orderNumberObjFilterFormatter(value, row) {
if (value) { if (value) {
return '<a href="{{ url('/') }}/hardware/?order_number=' + row.order_number + '"> ' + row.order_number + '</a>'; return '<a href="{{ url('/') }}/hardware/?order_number=' + row.order_number + '"> ' + row.order_number + '</a>';