Added case switch for sorting on suppliers

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-04-13 11:13:45 -07:00
parent d2b3e251ad
commit 2fe7fcecdb
2 changed files with 15 additions and 1 deletions

View file

@ -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 Controller
case 'company':
$components = $components->OrderCompany($order);
break;
case 'supplier':
$components = $components->OrderSupplier($order);
break;
default:
$components = $components->orderBy($column_sort, $order);
break;

View file

@ -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 Controller
case 'company':
$consumables = $consumables->OrderCompany($order);
break;
case 'supplier':
$components = $consumables->OrderSupplier($order);
break;
default:
$consumables = $consumables->orderBy($column_sort, $order);
break;