mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 14:27:33 -08:00
Added case switch for sorting on suppliers
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
d2b3e251ad
commit
2fe7fcecdb
|
@ -46,7 +46,7 @@ class ComponentsController extends Controller
|
||||||
|
|
||||||
|
|
||||||
$components = Company::scopeCompanyables(Component::select('components.*')
|
$components = Company::scopeCompanyables(Component::select('components.*')
|
||||||
->with('company', 'location', 'category', 'assets'));
|
->with('company', 'location', 'category', 'assets', 'supplier'));
|
||||||
|
|
||||||
if ($request->filled('search')) {
|
if ($request->filled('search')) {
|
||||||
$components = $components->TextSearch($request->input('search'));
|
$components = $components->TextSearch($request->input('search'));
|
||||||
|
@ -64,6 +64,10 @@ class ComponentsController extends Controller
|
||||||
$components->where('category_id', '=', $request->input('category_id'));
|
$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')) {
|
if ($request->filled('location_id')) {
|
||||||
$components->where('location_id', '=', $request->input('location_id'));
|
$components->where('location_id', '=', $request->input('location_id'));
|
||||||
}
|
}
|
||||||
|
@ -94,6 +98,9 @@ class ComponentsController extends Controller
|
||||||
case 'company':
|
case 'company':
|
||||||
$components = $components->OrderCompany($order);
|
$components = $components->OrderCompany($order);
|
||||||
break;
|
break;
|
||||||
|
case 'supplier':
|
||||||
|
$components = $components->OrderSupplier($order);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$components = $components->orderBy($column_sort, $order);
|
$components = $components->orderBy($column_sort, $order);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -75,6 +75,10 @@ class ConsumablesController extends Controller
|
||||||
$consumables->where('manufacturer_id', '=', $request->input('manufacturer_id'));
|
$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')) {
|
if ($request->filled('location_id')) {
|
||||||
$consumables->where('location_id','=',$request->input('location_id'));
|
$consumables->where('location_id','=',$request->input('location_id'));
|
||||||
}
|
}
|
||||||
|
@ -111,6 +115,9 @@ class ConsumablesController extends Controller
|
||||||
case 'company':
|
case 'company':
|
||||||
$consumables = $consumables->OrderCompany($order);
|
$consumables = $consumables->OrderCompany($order);
|
||||||
break;
|
break;
|
||||||
|
case 'supplier':
|
||||||
|
$components = $consumables->OrderSupplier($order);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$consumables = $consumables->orderBy($column_sort, $order);
|
$consumables = $consumables->orderBy($column_sort, $order);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue