Minor transformer cleanup

This commit is contained in:
snipe 2017-01-25 21:01:00 -08:00
parent 855d775c41
commit a9bf34cf61
3 changed files with 16 additions and 6 deletions

View file

@ -24,7 +24,7 @@ class AssetsTransformer
'name' => $asset->name,
'asset_tag' => $asset->asset_tag,
'serial' => $asset->serial,
'model' => ($asset->model) ? $asset->model : '',
'model' => ($asset->model) ? ['id' => $asset->model->id,'name'=> $asset->model->name] : '',
'model_number' => $asset->model_number,
'status_label' => ($asset->assetstatus) ? $asset->assetstatus : null,
'last_checkout' => $asset->last_checkout,
@ -44,6 +44,16 @@ class AssetsTransformer
];
if ($asset->model->fieldset) {
foreach($asset->model->fieldset->fields as $field) {
$fields_array = [$field->name => $asset->{$field->convertUnicodeDbSlug()}];
$array += $fields_array;
//array_push($array, $fields_array);
}
}
return $array;
}

View file

@ -85,7 +85,7 @@
<th data-sortable="true" data-formatter="usersLinkObjFormatter" data-field="assigned_to">{{ trans('admin/hardware/form.checkedout_to') }}</th>
<th data-sortable="true" data-formatter="locationsLinkObjFormatter" data-field="location" data-searchable="true">{{ trans('admin/hardware/table.location') }}</th>
<th data-sortable="true" data-field="category" data-searchable="true" data-formatter="categoriesLinkObjFormatter">{{ trans('general.category') }}</th>
<th data-sortable="true" data-field="manufacturer" data-formatter="manufacturerssLinkObjFormatter" data-searchable="true" data-visible="false">{{ trans('general.manufacturer') }}</th>
<th data-sortable="true" data-field="manufacturer" data-formatter="manufacturersLinkObjFormatter" data-searchable="true" data-visible="false">{{ trans('general.manufacturer') }}</th>
<th data-sortable="true" data-field="purchase_cost" data-searchable="true" data-visible="false">{{ trans('admin/hardware/form.cost') }}</th>
<th data-sortable="true" data-field="purchase_date" data-searchable="true" data-visible="false">{{ trans('admin/hardware/form.date') }}</th>
<th data-sortable="false" data-field="eol" data-searchable="true">{{ trans('general.eol') }}</th>
@ -93,10 +93,10 @@
<th data-sortable="true" data-searchable="true" data-field="order_number">{{ trans('admin/hardware/form.order') }}</th>
<th data-sortable="true" data-searchable="true" data-field="last_checkout">{{ trans('admin/hardware/table.checkout_date') }}</th>
<th data-sortable="true" data-field="expected_checkin" data-searchable="true">{{ trans('admin/hardware/form.expected_checkin') }}</th>
@foreach(\App\Models\CustomField::all() AS $field)
@foreach(\App\Models\CustomField::all() as $field)
<th data-sortable="{{ ($field->field_encrypted=='1' ? 'false' : 'true') }}" data-visible="false" data-field="{{$field->db_column_name()}}">
<th data-sortable="{{ ($field->field_encrypted=='1' ? 'false' : 'true') }}" data-visible="false" data-field="{{$field->convertUnicodeDbSlug()}}">
@if ($field->field_encrypted=='1')
<i class="fa fa-lock"></i>
@endif

View file

@ -75,14 +75,14 @@
<th data-switchable="true" data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
<th data-switchable="true" data-sortable="false" data-field="companyName" data-visible="false">{{ trans('admin/companies/table.title') }}</th>
<th data-switchable="true" data-sortable="true" data-field="employee_num" data-visible="false">{{ trans('admin/users/table.employee_num') }}</th>
<th data-sortable="true" data-field="name" data-formatter="userLinkFormatter">{{ trans('admin/users/table.name') }}</th>
<th data-sortable="true" data-field="name" data-formatter="usersLinkFormatter">{{ trans('admin/users/table.name') }}</th>
<th data-switchable="true" data-sortable="true" data-field="jobtitle" data-visible="false">{{ trans('admin/users/table.title') }}</th>
<th data-sortable="true" data-field="email" data-formatter="emailFormatter">
<span class="hidden-md hidden-lg">{{ trans('admin/users/table.email') }}</span>
<span class="hidden-xs"><i class="fa fa-envelope fa-lg"></i></span>
</th>
<th data-sortable="true" data-field="username">{{ trans('admin/users/table.username') }}</th>
<th data-searchable="true" data-sortable="true" data-field="manager" data-formatter="userLinkObjFormatter">{{ trans('admin/users/table.manager') }}</th>
<th data-searchable="true" data-sortable="true" data-field="manager" data-formatter="usersLinkObjFormatter">{{ trans('admin/users/table.manager') }}</th>
<th data-sortable="true" data-field="location" data-formatter="locationsLinkObjFormatter">{{ trans('admin/users/table.location') }}</th>
<th data-sortable="false" data-field="assets">
<span class="hidden-md hidden-lg">Assets</span>