mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
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:
parent
5e76d50f2d
commit
35ffe8b902
|
@ -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;
|
||||
|
|
|
@ -333,7 +333,9 @@
|
|||
|
||||
// This is only used by the requestable assets section
|
||||
function assetRequestActionsFormatter (row, value) {
|
||||
if (value.available_actions.cancel == true) {
|
||||
if (value.assigned_to_self == true){
|
||||
return '<button class="btn btn-danger btn-sm disabled" data-toggle="tooltip" title="Cancel this item request">{{ trans('button.cancel') }}</button>';
|
||||
} else if (value.available_actions.cancel == true) {
|
||||
return '<form action="{{ url('/') }}/account/request-asset/'+ value.id + '" method="GET"><button class="btn btn-danger btn-sm" data-toggle="tooltip" title="Cancel this item request">{{ trans('button.cancel') }}</button></form>';
|
||||
} else if (value.available_actions.request == true) {
|
||||
return '<form action="{{ url('/') }}/account/request-asset/'+ value.id + '" method="GET"><button class="btn btn-primary btn-sm" data-toggle="tooltip" title="Request this item">{{ trans('button.request') }}</button></form>';
|
||||
|
|
Loading…
Reference in a new issue