From 69325beddbf0166e1570b3b668e6932443d0b86a Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 12 Jun 2023 11:03:32 -0700 Subject: [PATCH 1/3] adds warranty confirmation to asset maintenance table --- app/Http/Transformers/AssetMaintenancesTransformer.php | 1 + resources/views/reports/asset_maintenances.blade.php | 1 + 2 files changed, 2 insertions(+) diff --git a/app/Http/Transformers/AssetMaintenancesTransformer.php b/app/Http/Transformers/AssetMaintenancesTransformer.php index 7766d7cd3a..3db87a162a 100644 --- a/app/Http/Transformers/AssetMaintenancesTransformer.php +++ b/app/Http/Transformers/AssetMaintenancesTransformer.php @@ -59,6 +59,7 @@ class AssetMaintenancesTransformer 'user_id' => ($assetmaintenance->admin) ? ['id' => $assetmaintenance->admin->id, 'name'=> e($assetmaintenance->admin->getFullNameAttribute())] : null, 'created_at' => Helper::getFormattedDateObject($assetmaintenance->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($assetmaintenance->updated_at, 'datetime'), + 'is_warranty'=> ($assetmaintenance->is_warranty) ? trans('general.yes') : trans('general.no'), ]; diff --git a/resources/views/reports/asset_maintenances.blade.php b/resources/views/reports/asset_maintenances.blade.php index e8d86fcb36..6747cbb788 100644 --- a/resources/views/reports/asset_maintenances.blade.php +++ b/resources/views/reports/asset_maintenances.blade.php @@ -48,6 +48,7 @@ {{ trans('admin/asset_maintenances/form.cost') }} {{ trans('general.location') }} {{ trans('admin/hardware/form.default_location') }} + {{ trans('admin/asset_maintenances/table.is_warranty') }} {{ trans('general.admin') }} {{ trans('admin/asset_maintenances/form.notes') }} From fc86530c9488e43cbd660cf6756531d64c09b24b Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 13 Jun 2023 09:10:42 -0700 Subject: [PATCH 2/3] uses the trueFalseFormatter now --- app/Http/Transformers/AssetMaintenancesTransformer.php | 2 +- app/Presenters/AssetMaintenancesPresenter.php | 1 + resources/views/reports/asset_maintenances.blade.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Transformers/AssetMaintenancesTransformer.php b/app/Http/Transformers/AssetMaintenancesTransformer.php index 3db87a162a..10b05b33af 100644 --- a/app/Http/Transformers/AssetMaintenancesTransformer.php +++ b/app/Http/Transformers/AssetMaintenancesTransformer.php @@ -59,7 +59,7 @@ class AssetMaintenancesTransformer 'user_id' => ($assetmaintenance->admin) ? ['id' => $assetmaintenance->admin->id, 'name'=> e($assetmaintenance->admin->getFullNameAttribute())] : null, 'created_at' => Helper::getFormattedDateObject($assetmaintenance->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($assetmaintenance->updated_at, 'datetime'), - 'is_warranty'=> ($assetmaintenance->is_warranty) ? trans('general.yes') : trans('general.no'), + 'is_warranty'=> $assetmaintenance->is_warranty, ]; diff --git a/app/Presenters/AssetMaintenancesPresenter.php b/app/Presenters/AssetMaintenancesPresenter.php index 8906b420d3..c4446c0b2a 100644 --- a/app/Presenters/AssetMaintenancesPresenter.php +++ b/app/Presenters/AssetMaintenancesPresenter.php @@ -95,6 +95,7 @@ class AssetMaintenancesPresenter extends Presenter 'searchable' => true, 'sortable' => true, 'title' => trans('admin/asset_maintenances/table.is_warranty'), + 'formatter' => 'trueFalseFormatter' ], [ 'field' => 'cost', 'searchable' => true, diff --git a/resources/views/reports/asset_maintenances.blade.php b/resources/views/reports/asset_maintenances.blade.php index 6747cbb788..9845553363 100644 --- a/resources/views/reports/asset_maintenances.blade.php +++ b/resources/views/reports/asset_maintenances.blade.php @@ -48,7 +48,7 @@ {{ trans('admin/asset_maintenances/form.cost') }} {{ trans('general.location') }} {{ trans('admin/hardware/form.default_location') }} - {{ trans('admin/asset_maintenances/table.is_warranty') }} + {{ trans('admin/asset_maintenances/table.is_warranty') }} {{ trans('general.admin') }} {{ trans('admin/asset_maintenances/form.notes') }} From ee50906e44b882e203841cd911870f44ad492058 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 13 Jun 2023 11:20:55 -0700 Subject: [PATCH 3/3] attempt to add warranty to api controller --- app/Http/Controllers/Api/AssetMaintenancesController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/AssetMaintenancesController.php b/app/Http/Controllers/Api/AssetMaintenancesController.php index b2870792f9..6da7ce23a1 100644 --- a/app/Http/Controllers/Api/AssetMaintenancesController.php +++ b/app/Http/Controllers/Api/AssetMaintenancesController.php @@ -71,7 +71,8 @@ class AssetMaintenancesController extends Controller 'asset_tag', 'asset_name', 'user_id', - 'supplier' + 'supplier', + 'is_warranty', ]; $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at';