A free open source IT asset/license management system
Added case switch for sorting on suppliers
snipe2fe7fcecdb24
diff --git a/app/Http/Controllers/Api/ComponentsController.php b/app/Http/Controllers/Api/ComponentsController.phpindex bf281d6b2b..2c1d8e75c0 100644--- a/app/Http/Controllers/Api/ComponentsController.php+++ b/app/Http/Controllers/Api/ComponentsController.php@@ -46,7 +46,7 @@ class ComponentsController extends Controller$components = Company::scopeCompanyables(Component::select('components.*')- ->with('company', 'location', 'category', 'assets'));+ ->with('company', 'location', 'category', 'assets', 'supplier'));if ($request->filled('search')) {$components = $components->TextSearch($request->input('search'));@@ -64,6 +64,10 @@ class ComponentsController extends Controller$components->where('category_id', '=', $request->input('category_id'));}+ if ($request->filled('supplier_id')) {+ $components->where('supplier_id', '=', $request->input('supplier_id'));+ }+if ($request->filled('location_id')) {$components->where('location_id', '=', $request->input('location_id'));}@@ -94,6 +98,9 @@ class ComponentsController extends Controllercase 'company':$components = $components->OrderCompany($order);break;+ case 'supplier':+ $components = $components->OrderSupplier($order);+ break;default:$components = $components->orderBy($column_sort, $order);break;diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.phpindex e9a069c379..25c411963b 100644--- a/app/Http/Controllers/Api/ConsumablesController.php+++ b/app/Http/Controllers/Api/ConsumablesController.php@@ -75,6 +75,10 @@ class ConsumablesController extends Controller$consumables->where('manufacturer_id', '=', $request->input('manufacturer_id'));}+ if ($request->filled('supplier_id')) {+ $consumables->where('supplier_id', '=', $request->input('supplier_id'));+ }+if ($request->filled('location_id')) {$consumables->where('location_id','=',$request->input('location_id'));}@@ -111,6 +115,9 @@ class ConsumablesController extends Controllercase 'company':$consumables = $consumables->OrderCompany($order);break;+ case 'supplier':+ $components = $consumables->OrderSupplier($order);+ break;default:$consumables = $consumables->orderBy($column_sort, $order);break;