Merge pull request #16785 from grokability/feature/sc-28956
Added checkout date to license seats
This commit is contained in:
commit
f2f17402c9
2 changed files with 13 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Transformers;
|
namespace App\Http\Transformers;
|
||||||
|
|
||||||
|
use App\Helpers\Helper;
|
||||||
use App\Models\License;
|
use App\Models\License;
|
||||||
use App\Models\LicenseSeat;
|
use App\Models\LicenseSeat;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
@ -26,6 +27,7 @@ class LicenseSeatsTransformer
|
||||||
$array = [
|
$array = [
|
||||||
'id' => (int) $seat->id,
|
'id' => (int) $seat->id,
|
||||||
'license_id' => (int) $seat->license->id,
|
'license_id' => (int) $seat->license->id,
|
||||||
|
'updated_at' => Helper::getFormattedDateObject($seat->updated_at, 'datetime'), // we use updated_at here because the record gets updated when it's checked in or out
|
||||||
'assigned_user' => ($seat->user) ? [
|
'assigned_user' => ($seat->user) ? [
|
||||||
'id' => (int) $seat->user->id,
|
'id' => (int) $seat->user->id,
|
||||||
'name'=> e($seat->user->present()->fullName),
|
'name'=> e($seat->user->present()->fullName),
|
||||||
|
@ -36,14 +38,17 @@ class LicenseSeatsTransformer
|
||||||
'name' => e($seat->user->department->name),
|
'name' => e($seat->user->department->name),
|
||||||
|
|
||||||
] : null,
|
] : null,
|
||||||
|
'created_at' => Helper::getFormattedDateObject($seat->created_at, 'datetime'),
|
||||||
] : null,
|
] : null,
|
||||||
'assigned_asset' => ($seat->asset) ? [
|
'assigned_asset' => ($seat->asset) ? [
|
||||||
'id' => (int) $seat->asset->id,
|
'id' => (int) $seat->asset->id,
|
||||||
'name'=> e($seat->asset->present()->fullName),
|
'name'=> e($seat->asset->present()->fullName),
|
||||||
|
'created_at' => Helper::getFormattedDateObject($seat->created_at, 'datetime'),
|
||||||
] : null,
|
] : null,
|
||||||
'location' => ($seat->location()) ? [
|
'location' => ($seat->location()) ? [
|
||||||
'id' => (int) $seat->location()->id,
|
'id' => (int) $seat->location()->id,
|
||||||
'name'=> e($seat->location()->name),
|
'name'=> e($seat->location()->name),
|
||||||
|
'created_at' => Helper::getFormattedDateObject($seat->created_at, 'datetime'),
|
||||||
] : null,
|
] : null,
|
||||||
'reassignable' => (bool) $seat->license->reassignable,
|
'reassignable' => (bool) $seat->license->reassignable,
|
||||||
'notes' => e($seat->notes),
|
'notes' => e($seat->notes),
|
||||||
|
|
|
@ -280,6 +280,14 @@ class LicensePresenter extends Presenter
|
||||||
'visible' => true,
|
'visible' => true,
|
||||||
'formatter' => 'locationsLinkObjFormatter',
|
'formatter' => 'locationsLinkObjFormatter',
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'field' => 'updated_at',
|
||||||
|
'searchable' => false,
|
||||||
|
'sortable' => true,
|
||||||
|
'visible' => false,
|
||||||
|
'title' => trans('general.date'),
|
||||||
|
'formatter' => 'dateDisplayFormatter',
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'field' => 'notes',
|
'field' => 'notes',
|
||||||
'searchable' => false,
|
'searchable' => false,
|
||||||
|
|
Loading…
Add table
Reference in a new issue