Adds a check to know if the asset is checked out to the logged in user to allow check the state int the view

This commit is contained in:
Ivan Nieto Vivanco
2021-07-20 18:56:22 -05:00
parent 5e76d50f2d
commit 35ffe8b902
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -185,12 +185,12 @@ class AssetsTransformer
'expected_checkin' => Helper::getFormattedDateObject($asset->expected_checkin, 'date'),
'location' => ($asset->location) ? e($asset->location->name) : null,
'status'=> ($asset->assetstatus) ? $asset->present()->statusMeta : null,
'assigned_to_self' => ($asset->assigned_to == \Auth::user()->id),
];
$permissions_array['available_actions'] = [
'cancel' => ($asset->isRequestedBy(\Auth::user())) ? true : false,
'request' => ($asset->isRequestedBy(\Auth::user())) ? false : true,
];
$array += $permissions_array;