diff --git a/app/Http/Transformers/AccessoriesTransformer.php b/app/Http/Transformers/AccessoriesTransformer.php index 96963baffd..0f025fe883 100644 --- a/app/Http/Transformers/AccessoriesTransformer.php +++ b/app/Http/Transformers/AccessoriesTransformer.php @@ -4,6 +4,7 @@ namespace App\Http\Transformers; use App\Models\Accessory; use Gate; use Illuminate\Database\Eloquent\Collection; +use App\Helpers\Helper; class AccessoriesTransformer { @@ -34,6 +35,8 @@ class AccessoriesTransformer 'order_number' => ($accessory->order_number) ? e($accessory->order_number) : null, 'min_qty' => ($accessory->min_amt) ? e($accessory->min_amt) : null, 'remaining_qty' => $accessory->numRemaining(), + 'created_at' => Helper::getFormattedDateObject($accessory->created_at, 'datetime'), + 'updated_at' => Helper::getFormattedDateObject($accessory->updated_at, 'datetime'), ]; diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index dc36ac8a06..9d1a299ca7 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Collection; use App\Http\Transformers\UsersTransformer; use Gate; use App\Helpers\Helper; -use App\Models\Setting; class AssetsTransformer @@ -24,7 +23,7 @@ class AssetsTransformer public function transformAsset (Asset $asset) { - $settings = Setting::getSettings(); + $array = [ 'id' => $asset->id, 'name' => e($asset->name), diff --git a/app/Http/Transformers/ComponentsTransformer.php b/app/Http/Transformers/ComponentsTransformer.php index b164a0d210..9fad635136 100644 --- a/app/Http/Transformers/ComponentsTransformer.php +++ b/app/Http/Transformers/ComponentsTransformer.php @@ -38,7 +38,7 @@ class ComponentsTransformer 'name' => e($component->category->name) ] : null, 'order_number' => e($component->order_number), - 'purchase_date' => $component->purchase_date, + 'purchase_date' => Helper::getFormattedDateObject($component->purchase_date, 'date'), 'purchase_cost' => Helper::formatCurrencyOutput($component->purchase_cost), 'remaining' => $component->numRemaining(), 'company' => ($component->company) ? @@ -46,6 +46,8 @@ class ComponentsTransformer 'id' => $component->company->id, 'name' => e($component->company->name) ] : null, + 'created_at' => Helper::getFormattedDateObject($component->created_at, 'datetime'), + 'updated_at' => Helper::getFormattedDateObject($component->updated_at, 'datetime'), ]; diff --git a/app/Http/Transformers/ConsumablesTransformer.php b/app/Http/Transformers/ConsumablesTransformer.php index b9ffba61fa..3c98d67982 100644 --- a/app/Http/Transformers/ConsumablesTransformer.php +++ b/app/Http/Transformers/ConsumablesTransformer.php @@ -33,8 +33,10 @@ class ConsumablesTransformer 'remaining' => $consumable->numRemaining(), 'order_number' => $consumable->order_number, 'purchase_cost' => Helper::formatCurrencyOutput($consumable->purchase_cost), - 'purchase_date' => $consumable->purchase_date, + 'purchase_date' => Helper::getFormattedDateObject($consumable->purchase_date, 'date'), 'qty' => $consumable->qty, + 'created_at' => Helper::getFormattedDateObject($consumable->created_at, 'datetime'), + 'updated_at' => Helper::getFormattedDateObject($consumable->updated_at, 'datetime'), ]; $permissions_array['available_actions'] = [ diff --git a/app/Http/Transformers/GroupsTransformer.php b/app/Http/Transformers/GroupsTransformer.php index 482efe8b19..d5bd56ea01 100644 --- a/app/Http/Transformers/GroupsTransformer.php +++ b/app/Http/Transformers/GroupsTransformer.php @@ -24,6 +24,8 @@ class GroupsTransformer 'name' => e($group->name), 'permissions' => $group->permissions, 'users_count' => $group->users_count, + 'created_at' => Helper::getFormattedDateObject($group->created_at, 'datetime'), + 'updated_at' => Helper::getFormattedDateObject($group->updated_at, 'datetime'), ]; $permissions_array['available_actions'] = [ diff --git a/app/Http/Transformers/LicensesTransformer.php b/app/Http/Transformers/LicensesTransformer.php index a66b32f964..37e2beee3c 100644 --- a/app/Http/Transformers/LicensesTransformer.php +++ b/app/Http/Transformers/LicensesTransformer.php @@ -28,11 +28,11 @@ class LicensesTransformer 'product_key' => e($license->serial), 'order_number' => e($license->order_number), 'purchase_order' => e($license->purchase_order), - 'purchase_date' => e($license->purchase_date), + 'purchase_date' => Helper::getFormattedDateObject($license->purchase_date, 'date'), 'purchase_cost' => e($license->purchase_cost), 'depreciation' => ($license->depreciation) ? ['id' => $license->depreciation->id,'name'=> e($license->depreciation->name)] : null, 'notes' => e($license->notes), - 'expiration_date' => e($license->expiration_date), + 'expiration_date' => Helper::getFormattedDateObject($license->expiration_date, 'date'), 'total_seats' => e($license->seats), 'remaining_qty' => $license->remaincount(), 'min_qty' => $license->remaincount(), @@ -40,7 +40,8 @@ class LicensesTransformer 'license_email' => e($license->license_email), 'maintained' => ($license->maintained == 1) ? true : false, 'supplier' => ($license->supplier) ? ['id' => $license->supplier->id,'name'=> e($license->supplier->name)] : null, - 'created_at' => $license->created_at, + 'created_at' => Helper::getFormattedDateObject($license->created_at, 'datetime'), + 'updated_at' => Helper::getFormattedDateObject($license->updated_at, 'datetime'), ]; $permissions_array['available_actions'] = [ diff --git a/app/Http/Transformers/StatuslabelsTransformer.php b/app/Http/Transformers/StatuslabelsTransformer.php index c513ba19db..7785436e87 100644 --- a/app/Http/Transformers/StatuslabelsTransformer.php +++ b/app/Http/Transformers/StatuslabelsTransformer.php @@ -4,6 +4,7 @@ namespace App\Http\Transformers; use App\Models\Statuslabel; use Illuminate\Database\Eloquent\Collection; use Gate; +use App\Helpers\Helper; class StatuslabelsTransformer { @@ -26,8 +27,8 @@ class StatuslabelsTransformer 'color' => ($statuslabel->color) ? e($statuslabel->color) : null, 'show_in_nav' => ($statuslabel->show_in_nav=='1') ? true : false, 'notes' => e($statuslabel->notes), - 'created_at' => $statuslabel->created_at, - 'updated_at' => $statuslabel->updated_at, + 'created_at' => Helper::getFormattedDateObject($statuslabel->created_at, 'datetime'), + 'updated_at' => Helper::getFormattedDateObject($statuslabel->updated_at, 'datetime'), ]; $permissions_array['available_actions'] = [ diff --git a/app/Http/Transformers/UsersTransformer.php b/app/Http/Transformers/UsersTransformer.php index 6625e52ba2..f21aba3448 100644 --- a/app/Http/Transformers/UsersTransformer.php +++ b/app/Http/Transformers/UsersTransformer.php @@ -5,6 +5,7 @@ use App\Models\User; use Illuminate\Database\Eloquent\Collection; use phpDocumentor\Reflection\Types\Integer; use Gate; +use App\Helpers\Helper; class UsersTransformer { @@ -35,19 +36,20 @@ class UsersTransformer 'permissions' => $user->decodePermissions(), 'activated' => ($user->activated =='1') ? true : false, 'two_factor_activated' => ($user->activated =='1') ? true : false, - 'created_at' => $user->created_at, - 'updated_at' => $user->updated_at, 'assets_count' => $user->assets_count, 'licenses_count' => $user->licenses_count, 'accessories_count' => $user->accessories_count, 'consumables_count' => $user->consumables_count, 'company' => ($user->company) ? ['id' => $user->company->id,'name'=> e($user->company->name)] : null, + 'created_at' => Helper::getFormattedDateObject($user->created_at, 'datetime'), + 'updated_at' => Helper::getFormattedDateObject($user->updated_at, 'datetime'), ]; $permissions_array['available_actions'] = [ - 'edit' => Gate::allows('edit', User::class) ? true : false, + 'update' => Gate::allows('update', User::class) ? true : false, 'delete' => Gate::allows('delete', User::class) ? true : false, ]; + $array += $permissions_array; return $array; diff --git a/app/Presenters/UserPresenter.php b/app/Presenters/UserPresenter.php index 600b4c9266..1f8045d4c3 100644 --- a/app/Presenters/UserPresenter.php +++ b/app/Presenters/UserPresenter.php @@ -28,12 +28,11 @@ class UserPresenter extends Presenter ], [ "field" => "id", - "searchable" => true, + "searchable" => false, "sortable" => true, - "switchable" => false, + "switchable" => true, "title" => trans('general.id'), - "visible" => false, - "formatter" => null + "visible" => false ], [ "field" => "company", @@ -175,7 +174,7 @@ class UserPresenter extends Presenter "switchable" => true, "title" => trans('general.created_at'), "visible" => false, - 'formatter' => 'createdAtFormatter' + 'formatter' => 'dateDisplayFormatter' ], [ "field" => "actions",