Added created_at and modified_at to asset listing/api

This commit is contained in:
snipe 2017-02-23 16:23:02 -08:00
parent 9e7f998df5
commit 9ccaad8b9c
4 changed files with 17 additions and 2 deletions

View file

@ -67,6 +67,7 @@ class AssetsController extends Controller
'image',
'assigned_to',
'created_at',
'updated_at',
'purchase_date',
'purchase_cost'
];

View file

@ -40,10 +40,11 @@ class AssetsTransformer
'location' => ($asset->assetLoc) ? ['id' => $asset->assetLoc->id,'name'=> e($asset->assetLoc->name)] : null,
'rtd_location' => ($asset->defaultLoc) ? ['id' => $asset->defaultLoc->id,'name'=> e($asset->defaultLoc->name)] : null,
'image' => ($asset->getImageUrl()) ? $asset->getImageUrl() : null,
'assigned_to' => ($asset->assigneduser) ? (new UsersTransformer)->transformUser($asset->assigneduser) : null,
'assigned_to' => ($asset->assigneduser) ? ['id' => $asset->assigneduser->id,'first_name'=> e( $asset->assigneduser->first_name), 'last_name'=> e( $asset->assigneduser->last_name)] : null,
'warranty' => ($asset->warranty_months > 0) ? e($asset->warranty_months).' '.trans('admin/hardware/form.months') : null,
'warranty_expires' => ($asset->warranty_months > 0) ? $asset->present()->warrantee_expires() : null,
'created_at' => $asset->created_at,
'created_at' => $asset->created_at->format('Y-m-d H:i:s'),
'updated_at' => $asset->updated_at->format('Y-m-d H:i:s'),
'purchase_date' => $asset->purchase_date,
'purchase_cost' => $asset->purchase_cost,
'can_checkout' => $asset->availableForCheckout(),

View file

@ -145,6 +145,18 @@ class AssetPresenter extends Presenter
"sortable" => true,
"visible" => false,
"title" => trans('general.notes'),
], [
"field" => "created_at",
"searchable" => false,
"sortable" => true,
"visible" => false,
"title" => trans('general.created_at'),
], [
"field" => "updated_at",
"searchable" => false,
"sortable" => true,
"visible" => false,
"title" => trans('general.updated_at')
]
];

View file

@ -44,6 +44,7 @@
'created' => 'Item Created',
'created_asset' => 'created asset',
'created_at' => 'Created at',
'updated_at' => 'Updated at',
'currency' => '$', // this is deprecated
'current' => 'Current',
'custom_report' => 'Custom Asset Report',