diff --git a/app/Http/Transformers/LicensesTransformer.php b/app/Http/Transformers/LicensesTransformer.php index ba8fb8e3e3..ddebf5707e 100644 --- a/app/Http/Transformers/LicensesTransformer.php +++ b/app/Http/Transformers/LicensesTransformer.php @@ -42,6 +42,7 @@ class LicensesTransformer 'supplier' => ($license->supplier) ? ['id' => $license->supplier->id,'name'=> e($license->supplier->name)] : null, 'created_at' => Helper::getFormattedDateObject($license->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($license->updated_at, 'datetime'), + 'user_can_checkout' => (bool) ($license->remaincount() > 0), ]; $permissions_array['available_actions'] = [ diff --git a/app/Presenters/LicensePresenter.php b/app/Presenters/LicensePresenter.php index 87ad17cbcc..c5ea1757eb 100644 --- a/app/Presenters/LicensePresenter.php +++ b/app/Presenters/LicensePresenter.php @@ -102,16 +102,29 @@ class LicensePresenter extends Presenter "sortable" => true, "visible" => false, "title" => trans('general.order_number'), - ], [ - "field" => "actions", - "searchable" => false, - "sortable" => false, - "switchable" => false, - "title" => trans('table.actions'), - "formatter" => "licensesActionsFormatter", ] ]; + $layout[] = [ + "field" => "checkincheckout", + "searchable" => false, + "sortable" => false, + "switchable" => true, + "title" => 'Checkin/Checkout', + "visible" => true, + "formatter" => "licensesInOutFormatter", + ]; + + $layout[] = [ + "field" => "actions", + "searchable" => false, + "sortable" => false, + "switchable" => false, + "title" => trans('table.actions'), + "formatter" => "licensesActionsFormatter", + ]; + + return json_encode($layout); }