mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Merge pull request #2119 from dmeltzer/fix-category-lists
Modify Helper::categoryList() to take a category type parameter.
This commit is contained in:
commit
51ab8ce41c
|
@ -117,12 +117,14 @@ class Helper
|
|||
}
|
||||
|
||||
|
||||
public static function categoryList()
|
||||
public static function categoryList($category_type = null)
|
||||
{
|
||||
$category_list = array('' => '') + Category::orderBy('name', 'asc')
|
||||
$categories = Category::orderBy('name', 'asc')
|
||||
->whereNull('deleted_at')
|
||||
->orderBy('name', 'asc')
|
||||
->pluck('name', 'id')->toArray();
|
||||
->orderBy('name', 'asc');
|
||||
if(!empty($category_type))
|
||||
$categories = $categories->where('category_type', '=', $category_type);
|
||||
$category_list = array('' => trans('general.select_category')) + $categories->pluck('name', 'id')->toArray();
|
||||
return $category_list;
|
||||
}
|
||||
|
||||
|
@ -150,7 +152,7 @@ class Helper
|
|||
|
||||
public static function manufacturerList()
|
||||
{
|
||||
$manufacturer_list = array('' => 'Select One') +
|
||||
$manufacturer_list = array('' => trans('general.select_manufacturer')) +
|
||||
Manufacturer::orderBy('name', 'asc')
|
||||
->pluck('name', 'id')->toArray();
|
||||
return $manufacturer_list;
|
||||
|
@ -164,7 +166,7 @@ class Helper
|
|||
|
||||
public static function managerList()
|
||||
{
|
||||
$manager_list = array('' => '') +
|
||||
$manager_list = array('' => trans('general.select_user')) +
|
||||
User::where('deleted_at', '=', null)
|
||||
->orderBy('last_name', 'asc')
|
||||
->orderBy('first_name', 'asc')->get()
|
||||
|
|
|
@ -52,7 +52,7 @@ class AccessoriesController extends Controller
|
|||
public function getCreate(Request $request)
|
||||
{
|
||||
// Show the page
|
||||
$category_list = array('' => '') + DB::table('categories')->where('category_type', '=', 'accessory')->whereNull('deleted_at')->orderBy('name', 'ASC')->lists('name', 'id');
|
||||
$category_list = Helper::categoryList('accessory');
|
||||
$company_list = Helper::companyList();
|
||||
$location_list = Helper::locationsList();
|
||||
return View::make('accessories/edit')
|
||||
|
@ -125,7 +125,7 @@ class AccessoriesController extends Controller
|
|||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$category_list = array('' => '') + DB::table('categories')->where('category_type', '=', 'accessory')->whereNull('deleted_at')->orderBy('name', 'ASC')->lists('name', 'id');
|
||||
$category_list = Helper::categoryList('accessory');
|
||||
$company_list = Helper::companyList();
|
||||
$location_list = Helper::locationsList();
|
||||
|
||||
|
|
|
@ -55,9 +55,9 @@ class AssetModelsController extends Controller
|
|||
public function getCreate()
|
||||
{
|
||||
// Show the page
|
||||
$depreciation_list = \App\Helpers\Helper::depreciationList();
|
||||
$manufacturer_list = \App\Helpers\Helper::manufacturerList();
|
||||
$category_list = \App\Helpers\Helper::categoryList();
|
||||
$depreciation_list = Helper::depreciationList();
|
||||
$manufacturer_list = Helper::manufacturerList();
|
||||
$category_list = Helper::categoryList('asset');
|
||||
return View::make('models/edit')
|
||||
->with('category_list', $category_list)
|
||||
->with('depreciation_list', $depreciation_list)
|
||||
|
@ -181,9 +181,9 @@ class AssetModelsController extends Controller
|
|||
return redirect()->to('assets/models')->with('error', trans('admin/models/message.does_not_exist'));
|
||||
}
|
||||
|
||||
$depreciation_list = \App\Helpers\Helper::depreciationList();
|
||||
$manufacturer_list = \App\Helpers\Helper::manufacturerList();
|
||||
$category_list = \App\Helpers\Helper::categoryList();
|
||||
$depreciation_list = Helper::depreciationList();
|
||||
$manufacturer_list = Helper::manufacturerList();
|
||||
$category_list = Helper::categoryList('asset');
|
||||
$view = View::make('models/edit', compact('model'));
|
||||
$view->with('category_list', $category_list);
|
||||
$view->with('depreciation_list', $depreciation_list);
|
||||
|
@ -371,9 +371,9 @@ class AssetModelsController extends Controller
|
|||
$model->id = null;
|
||||
|
||||
// Show the page
|
||||
$depreciation_list = array('' => 'Do Not Depreciate') + Depreciation::lists('name', 'id');
|
||||
$manufacturer_list = array('' => 'Select One') + Manufacturer::lists('name', 'id');
|
||||
$category_list = array('' => '') + DB::table('categories')->whereNull('deleted_at')->lists('name', 'id');
|
||||
$depreciation_list = Helper::depreciationList();
|
||||
$manufacturer_list = Helper::manufacturerList();
|
||||
$category_list = Helper::categoryList('asset');
|
||||
$view = View::make('models/edit');
|
||||
$view->with('category_list', $category_list);
|
||||
$view->with('depreciation_list', $depreciation_list);
|
||||
|
|
|
@ -107,7 +107,7 @@ class AssetsController extends Controller
|
|||
$statuslabel_list = Helper::statusLabelList();
|
||||
$location_list = Helper::locationsList();
|
||||
$manufacturer_list = Helper::manufacturerList();
|
||||
$category_list = Helper::categoryList();
|
||||
$category_list = Helper::categoryList('asset');
|
||||
$supplier_list = Helper::suppliersList();
|
||||
$company_list = Helper::companyList();
|
||||
$assigned_to = Helper::usersList();
|
||||
|
@ -269,11 +269,11 @@ class AssetsController extends Controller
|
|||
$statuslabel_list = Helper::statusLabelList();
|
||||
$location_list = Helper::locationsList();
|
||||
$manufacturer_list = Helper::manufacturerList();
|
||||
$category_list = Helper::categoryList();
|
||||
$category_list = Helper::categoryList('asset');
|
||||
$supplier_list = Helper::suppliersList();
|
||||
$company_list = Helper::companyList();
|
||||
$assigned_to = Helper::usersList();
|
||||
$statuslabel_types =Helper:: statusTypeList();
|
||||
$statuslabel_types =Helper::statusTypeList();
|
||||
|
||||
return View::make('hardware/edit', compact('asset'))
|
||||
->with('model_list', $model_list)
|
||||
|
@ -895,7 +895,7 @@ class AssetsController extends Controller
|
|||
$statuslabel_list = Helper::statusLabelList();
|
||||
$location_list = Helper::locationsList();
|
||||
$manufacturer_list = Helper::manufacturerList();
|
||||
$category_list = Helper::categoryList();
|
||||
$category_list = Helper::categoryList('asset');
|
||||
$supplier_list = Helper::suppliersList();
|
||||
$assigned_to =Helper::usersList();
|
||||
$statuslabel_types = Helper::statusTypeList();
|
||||
|
|
|
@ -54,7 +54,7 @@ class ComponentsController extends Controller
|
|||
public function getCreate()
|
||||
{
|
||||
// Show the page
|
||||
$category_list = array('' => '') + DB::table('categories')->where('category_type', '=', 'component')->whereNull('deleted_at')->orderBy('name', 'ASC')->lists('name', 'id');
|
||||
$category_list = Helper::categoryList('component');
|
||||
$company_list = Helper::companyList();
|
||||
$location_list = Helper::locationsList();
|
||||
|
||||
|
@ -133,7 +133,7 @@ class ComponentsController extends Controller
|
|||
return redirect()->to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$category_list = Helper::categoryList();
|
||||
$category_list = Helper::categoryList('component');
|
||||
$company_list = Helper::companyList();
|
||||
$location_list = Helper::locationsList();
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class ConsumablesController extends Controller
|
|||
public function getCreate()
|
||||
{
|
||||
// Show the page
|
||||
$category_list = array('' => '') + DB::table('categories')->where('category_type', '=', 'consumable')->whereNull('deleted_at')->orderBy('name', 'ASC')->lists('name', 'id');
|
||||
$category_list = Helper::categoryList('consumable');
|
||||
$company_list = Helper::companyList();
|
||||
$location_list = Helper::locationsList();
|
||||
$manufacturer_list = Helper::manufacturerList();
|
||||
|
@ -132,7 +132,7 @@ class ConsumablesController extends Controller
|
|||
return redirect()->to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$category_list = Helper::categoryList();
|
||||
$category_list = Helper::categoryList('consumable');
|
||||
$company_list = Helper::companyList();
|
||||
$location_list = Helper::locationsList();
|
||||
$manufacturer_list = Helper::manufacturerList();
|
||||
|
|
|
@ -121,12 +121,13 @@
|
|||
'quantity' => 'Quantity',
|
||||
'ready_to_deploy' => 'Ready to Deploy',
|
||||
'recent_activity' => 'Recent Activity',
|
||||
'remove_company' => 'Remove Company Association',
|
||||
'remove_company' => 'Remove Company Association',
|
||||
'reports' => 'Reports',
|
||||
'requested' => 'Requested',
|
||||
'save' => 'Save',
|
||||
'select' => 'Select',
|
||||
'search' => 'Search',
|
||||
'select_category' => 'Select a Category',
|
||||
'select_depreciation' => 'Select a Depreciation Type',
|
||||
'select_location' => 'Select a Location',
|
||||
'select_manufacturer' => 'Select a Manufacturer',
|
||||
|
@ -135,8 +136,8 @@
|
|||
'select_user' => 'Select a User',
|
||||
'select_date' => 'Select Date',
|
||||
'select_statuslabel' => 'Select Status',
|
||||
'select_company' => 'Select Company',
|
||||
'select_asset' => 'Select Asset',
|
||||
'select_company' => 'Select Company',
|
||||
'select_asset' => 'Select Asset',
|
||||
'settings' => 'Settings',
|
||||
'sign_in' => 'Sign in',
|
||||
'site_name' => 'Site Name',
|
||||
|
|
Loading…
Reference in a new issue