More ajax menu fixes

This commit is contained in:
snipe 2017-10-28 11:17:52 -07:00
parent 9c94e70917
commit 39c68214e9
26 changed files with 119 additions and 257 deletions

View file

@ -54,8 +54,8 @@ class AccessoriesController extends Controller
public function create(Request $request) public function create(Request $request)
{ {
$this->authorize('create', Accessory::class); $this->authorize('create', Accessory::class);
// Show the page $category_type = 'accessory';
return view('accessories/edit') return view('accessories/edit')->with('category_type', $category_type)
->with('item', new Accessory); ->with('item', new Accessory);
} }
@ -125,14 +125,15 @@ class AccessoriesController extends Controller
*/ */
public function edit(Request $request, $accessoryId = null) public function edit(Request $request, $accessoryId = null)
{ {
// Check if the accessory exists
if (is_null($item = Accessory::find($accessoryId))) { if ($item = Accessory::find($accessoryId)) {
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.does_not_exist')); $this->authorize($item);
$category_type = 'accessory';
return view('accessories/edit', compact('item'))->with('category_type', $category_type);
} }
$this->authorize($item); return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.does_not_exist'));
return view('accessories/edit', compact('item'));
} }

View file

@ -139,7 +139,7 @@ class CategoriesController extends Controller
* @see \App\Http\Transformers\SelectlistTransformer * @see \App\Http\Transformers\SelectlistTransformer
* *
*/ */
public function selectlist(Request $request) public function selectlist(Request $request, $category_type = 'asset')
{ {
$this->authorize('view', Categories::class); $this->authorize('view', Categories::class);
@ -153,7 +153,7 @@ class CategoriesController extends Controller
$categories = $categories->where('name', 'LIKE', '%'.$request->get('search').'%'); $categories = $categories->where('name', 'LIKE', '%'.$request->get('search').'%');
} }
$categories = $categories->orderBy('name', 'ASC')->paginate(50); $categories = $categories->where('category_type', $category_type)->orderBy('name', 'ASC')->paginate(50);
// Loop through and set some custom properties for the transformer to use. // Loop through and set some custom properties for the transformer to use.
// This lets us have more flexibility in special cases like assets, where // This lets us have more flexibility in special cases like assets, where

View file

@ -138,16 +138,15 @@ class UsersController extends Controller
$users = Company::scopeCompanyables($users); $users = Company::scopeCompanyables($users);
if ($request->has('search')) { if ($request->has('search')) {
$users = $users->where('first_name', '=', '%'.$request->get('search').'%') $users = $users->where('first_name', 'LIKE', '%'.$request->get('search').'%')
->orWhere('last_name', 'LIKE', '%'.$request->get('search').'%') ->orWhere('last_name', 'LIKE', '%'.$request->get('search').'%')
->orWhere('username', 'LIKE', '%'.$request->get('search').'%') ->orWhere('username', 'LIKE', '%'.$request->get('search').'%')
->orWhere('employee_num', '=', '%'.$request->get('search').'%'); ->orWhere('employee_num', 'LIKE', '%'.$request->get('search').'%');
} }
$users = $users->orderBy('last_name', 'asc'); $users = $users->orderBy('last_name', 'asc')->orderBy('first_name', 'asc');
$users = $users->paginate(50); $users = $users->paginate(50);
foreach ($users as $user) { foreach ($users as $user) {
$name_str = ''; $name_str = '';
if ($user->last_name!='') { if ($user->last_name!='') {

View file

@ -35,7 +35,6 @@ class AssetModelsController extends Controller
* the content for the accessories listing, which is generated in getDatatable. * the content for the accessories listing, which is generated in getDatatable.
* *
* @author [A. Gianotto] [<snipe@snipe.net>] * @author [A. Gianotto] [<snipe@snipe.net>]
* @see AssetModelsController::getDatatable() method that generates the JSON response
* @since [v1.0] * @since [v1.0]
* @return View * @return View
*/ */
@ -53,11 +52,9 @@ class AssetModelsController extends Controller
*/ */
public function create() public function create()
{ {
// Show the page $category_type = 'asset';
return view('models/edit') return view('models/edit')->with('category_type',$category_type)
->with('category_list', Helper::categoryList('asset'))
->with('depreciation_list', Helper::depreciationList()) ->with('depreciation_list', Helper::depreciationList())
->with('manufacturer_list', Helper::manufacturerList())
->with('item', new AssetModel); ->with('item', new AssetModel);
} }
@ -165,17 +162,15 @@ class AssetModelsController extends Controller
*/ */
public function edit($modelId = null) public function edit($modelId = null)
{ {
// Check if the model exists if ($item = AssetModel::find($modelId)) {
if (is_null($item = AssetModel::find($modelId))) { $category_type = 'asset';
// Redirect to the model management page $view = View::make('models/edit', compact('item','category_type'));
return redirect()->route('models.index')->with('error', trans('admin/models/message.does_not_exist')); $view->with('depreciation_list', Helper::depreciationList());
return $view;
} }
$view = View::make('models/edit', compact('item')); return redirect()->route('models.index')->with('error', trans('admin/models/message.does_not_exist'));
$view->with('category_list', Helper::categoryList('asset'));
$view->with('depreciation_list', Helper::depreciationList());
$view->with('manufacturer_list', Helper::manufacturerList());
return $view;
} }

View file

@ -255,14 +255,8 @@ class AssetsController extends Controller
return view('hardware/edit', compact('item')) return view('hardware/edit', compact('item'))
->with('model_list', Helper::modelList()) ->with('model_list', Helper::modelList())
->with('supplier_list', Helper::suppliersList())
->with('company_list', Helper::companyList())
->with('locations_list', Helper::locationsList())
->with('statuslabel_list', Helper::statusLabelList()) ->with('statuslabel_list', Helper::statusLabelList())
->with('assigned_to', Helper::usersList()) ->with('statuslabel_types', Helper::statusTypeList());
->with('manufacturer', Helper::manufacturerList())
->with('statuslabel_types', Helper::statusTypeList())
->with('category', Helper::categoryList('asset'));
} }
@ -720,18 +714,9 @@ class AssetsController extends Controller
$asset->assigned_to = ''; $asset->assigned_to = '';
return view('hardware/edit') return view('hardware/edit')
->with('supplier_list', Helper::suppliersList())
->with('model_list', Helper::modelList())
->with('statuslabel_list', Helper::statusLabelList()) ->with('statuslabel_list', Helper::statusLabelList())
->with('statuslabel_types', Helper::statusTypeList()) ->with('statuslabel_types', Helper::statusTypeList())
->with('assigned_to', Helper::usersList()) ->with('item', $asset);
->with('item', $asset)
->with('locations_list', Helper::locationsList())
->with('manufacturer', Helper::manufacturerList())
->with('category', Helper::categoryList('asset'))
->with('users_list', Helper::usersList())
->with('assets_list', Helper::assetsList())
->with('company_list', Helper::companyList());
} }
/** /**
@ -1035,8 +1020,7 @@ class AssetsController extends Controller
return view('hardware/labels') return view('hardware/labels')
->with('assets', Asset::find($asset_ids)) ->with('assets', Asset::find($asset_ids))
->with('settings', Setting::getSettings()) ->with('settings', Setting::getSettings())
->with('count', $count) ->with('count', $count);
->with('settings', Setting::getSettings());
} elseif ($request->input('bulk_actions')=='delete') { } elseif ($request->input('bulk_actions')=='delete') {
$assets = Asset::with('assignedTo', 'location')->find($asset_ids); $assets = Asset::with('assignedTo', 'location')->find($asset_ids);
$assets->each(function ($asset) { $assets->each(function ($asset) {
@ -1047,10 +1031,7 @@ class AssetsController extends Controller
} elseif ($request->input('bulk_actions')=='edit') { } elseif ($request->input('bulk_actions')=='edit') {
return view('hardware/bulk') return view('hardware/bulk')
->with('assets', request('ids')) ->with('assets', request('ids'))
->with('supplier_list', Helper::suppliersList())
->with('statuslabel_list', Helper::statusLabelList()) ->with('statuslabel_list', Helper::statusLabelList())
->with('location_list', Helper::locationsList())
->with('models_list', Helper::modelList())
->with( ->with(
'companies_list', 'companies_list',
array('' => '') + array('clear' => trans('general.remove_company')) + Helper::companyList() array('' => '') + array('clear' => trans('general.remove_company')) + Helper::companyList()
@ -1222,11 +1203,11 @@ class AssetsController extends Controller
} }
public function quickScan(Request $request) public function quickScan()
{ {
$this->authorize('audit', Asset::class); $this->authorize('audit', Asset::class);
$dt = Carbon::now()->addMonths(12)->toDateString(); $dt = Carbon::now()->addMonths(12)->toDateString();
return view('hardware/quickscan')->with('next_audit_date', $dt)->with('locations_list', Helper::locationsList()); return view('hardware/quickscan')->with('next_audit_date', $dt);
} }
@ -1236,7 +1217,7 @@ class AssetsController extends Controller
$this->authorize('audit', Asset::class); $this->authorize('audit', Asset::class);
$dt = Carbon::now()->addMonths(12)->toDateString(); $dt = Carbon::now()->addMonths(12)->toDateString();
$asset = Asset::findOrFail($id); $asset = Asset::findOrFail($id);
return view('hardware/audit')->with('asset', $asset)->with('next_audit_date', $dt)->with('locations_list', Helper::locationsList()); return view('hardware/audit')->with('asset', $asset)->with('next_audit_date', $dt)->with('locations_list');
} }
public function auditStore(Request $request, $id) public function auditStore(Request $request, $id)

View file

@ -59,8 +59,8 @@ class ComponentsController extends Controller
public function create() public function create()
{ {
$this->authorize('create', Component::class); $this->authorize('create', Component::class);
// Show the page $category_type = 'component';
return view('components/edit') return view('components/edit')->with('category_type',$category_type)
->with('item', new Component); ->with('item', new Component);
} }
@ -118,14 +118,18 @@ class ComponentsController extends Controller
*/ */
public function edit($componentId = null) public function edit($componentId = null)
{ {
if (is_null($item = Component::find($componentId))) {
return redirect()->route('components.index')->with('error', trans('admin/components/message.does_not_exist'));
if ($item = Component::find($componentId)) {
$this->authorize('update', $item);
$category_type = 'component';
return view('components/edit', compact('item'))->with('category_type', $category_type);
} }
return redirect()->route('components.index')->with('error', trans('admin/components/message.does_not_exist'));
$this->authorize('update', $item);
return view('components/edit', compact('item'))
->with('category_list', Helper::categoryList('component'));
} }

View file

@ -56,8 +56,8 @@ class ConsumablesController extends Controller
public function create() public function create()
{ {
$this->authorize('create', Consumable::class); $this->authorize('create', Consumable::class);
// Show the page $category_type = 'consumable';
return view('consumables/edit') return view('consumables/edit')->with('category_type', $category_type)
->with('item', new Consumable); ->with('item', new Consumable);
} }
@ -119,17 +119,14 @@ class ConsumablesController extends Controller
*/ */
public function edit($consumableId = null) public function edit($consumableId = null)
{ {
if (is_null($item = Consumable::find($consumableId))) { if ($item = Consumable::find($consumableId)) {
return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.does_not_exist')); $this->authorize($item);
$category_type = 'consumable';
return view('consumables/edit', compact('item'))->with('category_type', $category_type);
} }
$this->authorize($item); return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.does_not_exist'));
return view('consumables/edit', compact('item'))
->with('category_list', Helper::categoryList('consumable'))
->with('company_list', Helper::companyList())
->with('location_list', Helper::locationsList())
->with('manufacturer_list', Helper::manufacturerList());
} }

View file

@ -100,10 +100,7 @@ class DepartmentsController extends Controller
*/ */
public function create() public function create()
{ {
return view('departments/edit')->with('item', new Department) return view('departments/edit')->with('item', new Department);
->with('manager_list', Helper::managerList())
->with('location_list', Helper::locationsList())
->with('company_list', Helper::companyList());
} }
@ -144,10 +141,7 @@ class DepartmentsController extends Controller
if (is_null($item = Department::find($id))) { if (is_null($item = Department::find($id))) {
return redirect()->back()->with('error', trans('admin/locations/message.does_not_exist')); return redirect()->back()->with('error', trans('admin/locations/message.does_not_exist'));
} }
return view('departments/edit', compact('item')) return view('departments/edit', compact('item'));
->with('manager_list', Helper::managerList())
->with('location_list', Helper::locationsList())
->with('company_list', Helper::companyList());
} }
public function update(Request $request, $id) { public function update(Request $request, $id) {

View file

@ -65,8 +65,7 @@ class LocationsController extends Controller
return view('locations/edit') return view('locations/edit')
->with('location_options', $location_options) ->with('location_options', $location_options)
->with('item', new Location) ->with('item', new Location);
->with('manager_list', Helper::managerList());
} }

View file

@ -30,8 +30,7 @@ class ProfileController extends Controller
public function getIndex() public function getIndex()
{ {
$user = Auth::user(); $user = Auth::user();
$location_list = Helper::locationsList(); return view('account/profile', compact('user'));
return view('account/profile', compact('user'))->with('location_list', $location_list);
} }
/** /**

View file

@ -228,9 +228,9 @@ class UsersController extends Controller
public function edit($id) public function edit($id)
{ {
try {
$user = User::find($id); if ($user = User::find($id)) {
$this->authorize('update', $user); $this->authorize('update', $user);
$permissions = config('permissions'); $permissions = config('permissions');
@ -240,19 +240,14 @@ class UsersController extends Controller
$user->permissions = $user->decodePermissions(); $user->permissions = $user->decodePermissions();
$userPermissions = Helper::selectedPermissionsArray($permissions, $user->permissions); $userPermissions = Helper::selectedPermissionsArray($permissions, $user->permissions);
$permissions = $this->filterDisplayable($permissions); $permissions = $this->filterDisplayable($permissions);
} catch (UserNotFoundException $e) {
$error = trans('admin/users/message.user_not_found', compact('id')); return view('users/edit', compact('user', 'groups', 'userGroups', 'permissions', 'userPermissions'))->with('item', $user);
return redirect()->route('users.index')->with('error', $error);
} }
// Show the page $error = trans('admin/users/message.user_not_found', compact('id'));
return view('users/edit', compact('user', 'groups', 'userGroups', 'permissions', 'userPermissions')) return redirect()->route('users.index')->with('error', $error);
->with('location_list', Helper::locationsList())
->with('department_list', Helper::departmentList())
->with('company_list', Helper::companyList())
->with('manager_list', Helper::managerList());
} }
/** /**
@ -431,11 +426,6 @@ class UsersController extends Controller
if ($request->input('bulk_actions')=='edit') { if ($request->input('bulk_actions')=='edit') {
return view('users/bulk-edit', compact('users')) return view('users/bulk-edit', compact('users'))
->with('location_list', Helper::locationsList())
->with('company_list', Helper::companyList())
->with('manager_list', Helper::managerList())
->with('manager_list', Helper::managerList())
->with('department_list', Helper::departmentList())
->with('groups', Group::pluck('name', 'id')); ->with('groups', Group::pluck('name', 'id'));
} }
@ -721,7 +711,7 @@ class UsersController extends Controller
$user->first_name = ''; $user->first_name = '';
$user->last_name = ''; $user->last_name = '';
$user->email = substr($user->email, ($pos = strpos($user->email, '@')) !== false ? $pos : 0); $user->email = substr($user->email, ($pos = strpos($user->email, '@')) !== false ? $pos : 0);
;
$user->id = null; $user->id = null;
// Get this user groups // Get this user groups
@ -734,10 +724,6 @@ class UsersController extends Controller
// Show the page // Show the page
return view('users/edit', compact('permissions', 'userPermissions')) return view('users/edit', compact('permissions', 'userPermissions'))
->with('location_list', Helper::locationsList())
->with('company_list', Helper::companyList())
->with('manager_list', Helper::managerList())
->with('department_list', Helper::departmentList())
->with('user', $user) ->with('user', $user)
->with('groups', Group::pluck('name', 'id')) ->with('groups', Group::pluck('name', 'id'))
->with('userGroups', $userGroups) ->with('userGroups', $userGroups)

View file

@ -55,7 +55,8 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
'username' => 'required|string|min:1|unique_undeleted', 'username' => 'required|string|min:1|unique_undeleted',
'email' => 'email|nullable', 'email' => 'email|nullable',
'password' => 'required|min:6', 'password' => 'required|min:6',
'locale' => 'max:10|nullable' 'locale' => 'max:10|nullable',
'manager_id' => 'nullable|different:id',
]; ];

View file

@ -19,7 +19,7 @@
<div class="form-group {{ $errors->has('first_name') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('first_name') ? ' has-error' : '' }}">
<label for="first_name" class="col-md-3 control-label">{{ trans('general.first_name') }} <label for="first_name" class="col-md-3 control-label">{{ trans('general.first_name') }}
</label> </label>
<div class="col-md-5 required"> <div class="col-md-8 required">
<input class="form-control" type="text" name="first_name" id="first_name" value="{{ Input::old('first_name', $user->first_name) }}" /> <input class="form-control" type="text" name="first_name" id="first_name" value="{{ Input::old('first_name', $user->first_name) }}" />
{!! $errors->first('first_name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('first_name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div> </div>
@ -30,24 +30,15 @@
<label for="last_name" class="col-md-3 control-label"> <label for="last_name" class="col-md-3 control-label">
{{ trans('general.last_name') }} {{ trans('general.last_name') }}
</label> </label>
<div class="col-md-5 required"> <div class="col-md-8 required">
<input class="form-control" type="text" name="last_name" id="last_name" value="{{ Input::old('last_name', $user->last_name) }}" /> <input class="form-control" type="text" name="last_name" id="last_name" value="{{ Input::old('last_name', $user->last_name) }}" />
{!! $errors->first('last_name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('last_name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div> </div>
</div> </div>
<!-- Location --> <!-- Location -->
<div class="form-group {{ $errors->has('location_id') ? 'error' : '' }}"> @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
<label class="col-md-3 control-label" for="location_id">
{{ trans('general.location') }}
</label>
<div class="col-md-5">
<div class="field-box">
{{ Form::select('location_id', $location_list , Input::old('location_id', $user->location_id), array('class'=>'select2', 'style'=>'width:300px')) }}
{!! $errors->first('location_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
</div>
<!-- Language --> <!-- Language -->
<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}">
@ -62,7 +53,7 @@
<!-- Website URL --> <!-- Website URL -->
<div class="form-group {{ $errors->has('website') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('website') ? ' has-error' : '' }}">
<label for="website" class="col-md-3 control-label">{{ trans('general.website') }}</label> <label for="website" class="col-md-3 control-label">{{ trans('general.website') }}</label>
<div class="col-md-5"> <div class="col-md-8">
<input class="form-control" type="text" name="website" id="website" value="{{ Input::old('website', $user->website) }}" /> <input class="form-control" type="text" name="website" id="website" value="{{ Input::old('website', $user->website) }}" />
{!! $errors->first('website', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('website', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div> </div>
@ -73,7 +64,7 @@
<label for="gravatar" class="col-md-3 control-label">{{ trans('general.gravatar_email') }} <label for="gravatar" class="col-md-3 control-label">{{ trans('general.gravatar_email') }}
<small>(Private)</small> <small>(Private)</small>
</label> </label>
<div class="col-md-5"> <div class="col-md-8">
<input class="form-control" type="text" name="gravatar" id="gravatar" value="{{ Input::old('gravatar', $user->gravatar) }}" /> <input class="form-control" type="text" name="gravatar" id="gravatar" value="{{ Input::old('gravatar', $user->gravatar) }}" />
{!! $errors->first('gravatar', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('gravatar', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
<p> <p>
@ -87,7 +78,7 @@
@if ($user->avatar) @if ($user->avatar)
<div class="form-group {{ $errors->has('avatar_delete') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('avatar_delete') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="avatar_delete">{{ trans('general.avatar_delete') }}</label> <label class="col-md-3 control-label" for="avatar_delete">{{ trans('general.avatar_delete') }}</label>
<div class="col-md-5"> <div class="col-md-8">
{{ Form::checkbox('avatar_delete') }} {{ Form::checkbox('avatar_delete') }}
<img src="{{ url('/') }}/uploads/avatars/{{ $user->avatar }}" class="avatar img-circle"> <img src="{{ url('/') }}/uploads/avatars/{{ $user->avatar }}" class="avatar img-circle">
{!! $errors->first('avatar_delete', '<span class="alert-msg">:message</span>') !!} {!! $errors->first('avatar_delete', '<span class="alert-msg">:message</span>') !!}
@ -97,7 +88,7 @@
<div class="form-group {{ $errors->has('avatar') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('avatar') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="avatar">{{ trans('general.avatar_upload') }}</label> <label class="col-md-3 control-label" for="avatar">{{ trans('general.avatar_upload') }}</label>
<div class="col-md-5"> <div class="col-md-8">
{{ Form::file('avatar') }} {{ Form::file('avatar') }}
{!! $errors->first('avatar', '<span class="alert-msg">:message</span>') !!} {!! $errors->first('avatar', '<span class="alert-msg">:message</span>') !!}
</div> </div>

View file

@ -11,26 +11,17 @@
@include ('partials.forms.edit.name', ['translated_name' => trans('admin/departments/table.name')]) @include ('partials.forms.edit.name', ['translated_name' => trans('admin/departments/table.name')])
@include ('partials.forms.edit.company') <!-- Company -->
@if (\App\Models\Company::canManageUsersCompanies())
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'), 'fieldname' => 'company_id'])
@endif
<!-- Manager --> <!-- Manager -->
<div class="form-group {{ $errors->has('manager_id') ? 'has-error' : '' }}"> @include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
<label class="col-md-3 control-label" for="manager_id">{{ trans('admin/users/table.manager') }}</label>
<div class="col-md-8">
{{ Form::select('manager_id', $manager_list , Input::old('manager_id', $item->manager_id), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('manager_id', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
<!-- Location --> <!-- Location -->
<div class="form-group {{ $errors->has('location_id') ? 'has-error' : '' }}"> @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
<label class="col-md-3 control-label" for="location_id">{{ trans('admin/departments/table.location') }}
</label>
<div class="col-md-8">
{{ Form::select('location_id', $location_list , Input::old('location_id', $item->location_id), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('location_id', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
<!-- Image --> <!-- Image -->
@if ($item->image) @if ($item->image)

View file

@ -45,14 +45,7 @@
</div> </div>
<!-- Locations --> <!-- Locations -->
<div id="location_id" class="form-group{{ $errors->has('location_id') ? ' has-error' : '' }}"> @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
{{ Form::label('location_id', trans('general.location'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-9">
{{ Form::select('location_id', $locations_list , Input::old('location_id'), array('class'=>'select2', 'id'=>'location_id', 'style'=>'width:100%')) }}
{!! $errors->first('location_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Next Audit --> <!-- Next Audit -->

View file

@ -30,7 +30,7 @@
<div class="box-body"> <div class="box-body">
<!-- Purchase Date --> <!-- Purchase Date -->
<div class="form-group {{ $errors->has('purchase_date') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('purchase_date') ? ' has-error' : '' }}">
<label for="purchase_date" class="col-md-2 control-label">{{ trans('admin/hardware/form.date') }}</label> <label for="purchase_date" class="col-md-3 control-label">{{ trans('admin/hardware/form.date') }}</label>
<div class="input-group col-md-3"> <div class="input-group col-md-3">
<input type="date" class="datepicker form-control" data-date-format="yyyy-mm-dd" placeholder="Select Date" name="purchase_date" id="purchase_date" value="{{ Input::old('purchase_date') }}"> <input type="date" class="datepicker form-control" data-date-format="yyyy-mm-dd" placeholder="Select Date" name="purchase_date" id="purchase_date" value="{{ Input::old('purchase_date') }}">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
@ -40,7 +40,7 @@
<!-- Status --> <!-- Status -->
<div class="form-group {{ $errors->has('status_id') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('status_id') ? ' has-error' : '' }}">
<label for="status_id" class="col-md-2 control-label"> <label for="status_id" class="col-md-3 control-label">
{{ trans('admin/hardware/form.status') }} {{ trans('admin/hardware/form.status') }}
</label> </label>
<div class="col-md-7"> <div class="col-md-7">
@ -49,31 +49,15 @@
</div> </div>
</div> </div>
<!-- Asset Model --> @include ('partials.forms.edit.model-select', ['translated_name' => trans('admin/hardware/form.model'), 'fieldname' => 'model_id'])
<div class="form-group {{ $errors->has('model_id') ? ' has-error' : '' }}">
<label for="model_id" class="col-md-2 control-label">
{{ trans('admin/hardware/form.model') }}
</label>
<div class="col-md-7">
{{ Form::select('model_id', $models_list , Input::old('model_id'), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('model_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Default Location --> <!-- Default Location -->
<div class="form-group {{ $errors->has('status_id') ? ' has-error' : '' }}"> @include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/hardware/form.default_location'), 'fieldname' => 'location_id'])
<label for="status_id" class="col-md-2 control-label">
{{ trans('admin/hardware/form.default_location') }}
</label>
<div class="col-md-7">
{{ Form::select('rtd_location_id', $location_list , Input::old('rtd_location_id'), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('status_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Purchase Cost -->
<!-- Purchase Cost -->
<div class="form-group {{ $errors->has('purchase_cost') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('purchase_cost') ? ' has-error' : '' }}">
<label for="purchase_cost" class="col-md-2 control-label"> <label for="purchase_cost" class="col-md-3 control-label">
{{ trans('admin/hardware/form.cost') }} {{ trans('admin/hardware/form.cost') }}
</label> </label>
<div class="input-group col-md-3"> <div class="input-group col-md-3">
@ -84,19 +68,12 @@
</div> </div>
<!-- Supplier --> <!-- Supplier -->
<div class="form-group {{ $errors->has('supplier_id') ? ' has-error' : '' }}"> @include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
<label for="supplier_id" class="col-md-2 control-label">
{{ trans('general.supplier') }}
</label>
<div class="col-md-7">
{{ Form::select('supplier_id', $supplier_list , Input::old('supplier_id'), array('class'=>'select2', 'style'=>'min-width:350px')) }}
{!! $errors->first('supplier_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Company -->
<!-- Company -->
<div class="form-group {{ $errors->has('company_id') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('company_id') ? ' has-error' : '' }}">
<label for="company_id" class="col-md-2 control-label"> <label for="company_id" class="col-md-3 control-label">
{{ trans('general.company') }} {{ trans('general.company') }}
</label> </label>
<div class="col-md-7"> <div class="col-md-7">
@ -107,7 +84,7 @@
<!-- Order Number --> <!-- Order Number -->
<div class="form-group {{ $errors->has('order_number') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('order_number') ? ' has-error' : '' }}">
<label for="order_number" class="col-md-2 control-label"> <label for="order_number" class="col-md-3 control-label">
{{ trans('admin/hardware/form.order') }} {{ trans('admin/hardware/form.order') }}
</label> </label>
<div class="col-md-7"> <div class="col-md-7">
@ -118,12 +95,12 @@
<!-- Warranty --> <!-- Warranty -->
<div class="form-group {{ $errors->has('warranty_months') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('warranty_months') ? ' has-error' : '' }}">
<label for="warranty_months" class="col-md-2 control-label"> <label for="warranty_months" class="col-md-3 control-label">
{{ trans('admin/hardware/form.warranty') }} {{ trans('admin/hardware/form.warranty') }}
</label> </label>
<div class="col-md-2"> <div class="col-md-2">
<div class="input-group"> <div class="input-group">
<input class="col-md-2 form-control" type="text" name="warranty_months" id="warranty_months" value="{{ Input::old('warranty_months') }}" /> <input class="col-md-3 form-control" type="text" name="warranty_months" id="warranty_months" value="{{ Input::old('warranty_months') }}" />
<span class="input-group-addon">{{ trans('admin/hardware/form.months') }}</span> <span class="input-group-addon">{{ trans('admin/hardware/form.months') }}</span>
{!! $errors->first('warranty_months', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('warranty_months', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div> </div>
@ -132,10 +109,10 @@
<!-- Requestable --> <!-- Requestable -->
<div class="form-group {{ $errors->has('requestable') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('requestable') ? ' has-error' : '' }}">
<label for="requestable" class="col-md-2 control-label"> <label for="requestable" class="col-md-3 control-label">
{{ trans('admin/hardware/form.requestable') }} {{ trans('admin/hardware/form.requestable') }}
</label> </label>
<div class="col-md-10"> <div class="col-md-7 col-md-offset-3">
<label class="radio"> <label class="radio">
<input type="radio" name="requestable" value="1"> Yes <input type="radio" name="requestable" value="1"> Yes
</label> </label>

View file

@ -43,14 +43,7 @@
<!-- Locations --> <!-- Locations -->
<div id="location_id" class="form-group{{ $errors->has('location_id') ? ' has-error' : '' }}"> @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
{{ Form::label('location_id', trans('general.location'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-9">
{{ Form::select('location_id', $locations_list , Input::old('location_id'), array('class'=>'select2', 'id'=>'location_id', 'style'=>'width:100%')) }}
{!! $errors->first('location_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Next Audit --> <!-- Next Audit -->

View file

@ -22,15 +22,7 @@
</div> </div>
<!-- Manager--> <!-- Manager-->
<div class="form-group {{ $errors->has('manager_id') ? ' has-error' : '' }}"> @include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
<label for="manager_id" class="col-md-3 control-label">
{{ trans('admin/users/table.manager') }}
</label>
<div class="col-md-9{{ (\App\Helpers\Helper::checkIfRequired($item, 'manager_id')) ? ' required' : '' }}">
{!! Form::select('manager_id', $manager_list , Input::old('manager_id', $item->manager_id), array('class'=>'select2 parent', 'style'=>'width:350px')) !!}
{!! $errors->first('manager_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Currency --> <!-- Currency -->
<div class="form-group {{ $errors->has('currency') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('currency') ? ' has-error' : '' }}">

View file

@ -4,7 +4,7 @@
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }} {{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7 required"> <div class="col-md-7 required">
<select class="js-data-ajax" data-endpoint="categories" name="{{ $fieldname }}" style="width: 100%" id="category_select_id"> <select class="js-data-ajax" data-endpoint="categories/{{ (isset($category_type)) ? $category_type : 'assets' }}" name="{{ $fieldname }}" style="width: 100%" id="category_select_id">
@if ($category_id = Input::old($fieldname, $item->{$fieldname})) @if ($category_id = Input::old($fieldname, $item->{$fieldname}))
<option value="{{ $category_id }}" selected="selected"> <option value="{{ $category_id }}" selected="selected">
{{ \App\Models\Category::find($category_id)->name }} {{ \App\Models\Category::find($category_id)->name }}

View file

@ -5,7 +5,7 @@
<div class="col-md-7 required"> <div class="col-md-7 required">
<select class="js-data-ajax" data-endpoint="models" name="{{ $fieldname }}" style="width: 100%" id="model_select_id"> <select class="js-data-ajax" data-endpoint="models" name="{{ $fieldname }}" style="width: 100%" id="model_select_id">
@if ($model_id = Input::old($fieldname, $item->{$fieldname})) @if ($model_id = Input::old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
<option value="{{ $model_id }}" selected="selected"> <option value="{{ $model_id }}" selected="selected">
{{ \App\Models\AssetModel::find($model_id)->name }} {{ \App\Models\AssetModel::find($model_id)->name }}
</option> </option>

View file

@ -3,8 +3,8 @@
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }} {{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7 required"> <div class="col-md-7 required">
<select class="js-data-ajax" data-endpoint="suppliers" name="{{ $fieldname }}" style="width: 100%" id="suppliers_select"> <select class="js-data-ajax" data-endpoint="suppliers" name="{{ $fieldname }}" style="width: 100%" id="supplier_select">
@if ($supplier_id = Input::old($fieldname, $item->{$fieldname})) @if ($supplier_id = Input::old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
<option value="{{ $supplier_id }}" selected="selected"> <option value="{{ $supplier_id }}" selected="selected">
{{ \App\Models\Supplier::find($supplier_id)->name }} {{ \App\Models\Supplier::find($supplier_id)->name }}
</option> </option>

View file

@ -4,9 +4,9 @@
<div class="col-md-7 required"> <div class="col-md-7 required">
<select class="js-data-ajax" data-endpoint="users" name="{{ $fieldname }}" style="width: 100%" id="assigned_user_select"> <select class="js-data-ajax" data-endpoint="users" name="{{ $fieldname }}" style="width: 100%" id="assigned_user_select">
@if ($user_id = Input::old($fieldname, (isset($item)) ? $item->{$fieldname} : '')) @if ($user_id = Input::old($fieldname, $item->{$fieldname}))
<option value="{{ $user_id }}" selected="selected"> <option value="{{ $user_id }}" selected="selected">
{{ \App\Models\User::find($user_id)->name }} {{ \App\Models\User::find($user_id)->present()->fullName }}
</option> </option>
@else @else
<option value="">{{ trans('general.select_user') }}</option> <option value="">{{ trans('general.select_user') }}</option>

View file

@ -30,50 +30,21 @@
<div class="box-body"> <div class="box-body">
<!-- Location -->
<div class="form-group {{ $errors->has('location_id') ? ' has-error' : '' }}">
<label for="status_id" class="col-md-3 control-label">
{{ trans('admin/users/table.location') }}
</label>
<div class="col-md-7">
{{ Form::select('location_id', $location_list , Input::old('rtd_location_id'), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('location_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Department --> <!-- Department -->
<div class="form-group {{ $errors->has('department_id') ? ' has-error' : '' }}"> @include ('partials.forms.edit.department-select', ['translated_name' => trans('general.department'), 'fieldname' => 'department_id'])
<label for="status_id" class="col-md-3 control-label">
{{ trans('general.department') }}
</label> <!-- Location -->
<div class="col-md-7"> @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
{{ Form::select('department_id', $department_list , Input::old('department_id'), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('department_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Company --> <!-- Company -->
<div class="form-group {{ $errors->has('company_id') ? ' has-error' : '' }}"> @if (\App\Models\Company::canManageUsersCompanies())
<label for="company_id" class="col-md-3 control-label"> @include ('partials.forms.edit.company-select', ['translated_name' => trans('general.select_company'), 'fieldname' => 'company_id'])
{{ trans('general.company') }} @endif
</label>
<div class="col-md-7">
{{ Form::select('company_id', $company_list , Input::old('company_id'), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('company_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- manager --> <!-- Manager -->
<div class="form-group {{ $errors->has('manager_id') ? ' has-error' : '' }}"> @include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
<label for="manager_id" class="col-md-3 control-label">
{{ trans('admin/users/table.manager') }}
</label>
<div class="col-md-7">
{{ Form::select('manager_id', $manager_list , Input::old('manager_id'), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('manager_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- activated --> <!-- activated -->
<div class="form-group"> <div class="form-group">

View file

@ -178,6 +178,8 @@
class="form-control" class="form-control"
value="" value=""
autocomplete="off" autocomplete="off"
readonly
onfocus="this.removeAttribute('readonly');"
{{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }} {{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }}
> >
@if (config('app.lock_passwords') && ($user->id)) @if (config('app.lock_passwords') && ($user->id))
@ -256,14 +258,14 @@
<!-- Manager --> <!-- Manager -->
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'manager_id']) @include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
<!-- Department --> <!-- Department -->
@include ('partials.forms.edit.department-select', ['translated_name' => trans('general.select_department'), 'fieldname' => 'department_id']) @include ('partials.forms.edit.department-select', ['translated_name' => trans('general.department'), 'fieldname' => 'department_id'])
<!-- Location --> <!-- Location -->
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.select_location'), 'fieldname' => 'location_id']) @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
<!-- Phone --> <!-- Phone -->
<div class="form-group {{ $errors->has('phone') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('phone') ? 'has-error' : '' }}">

View file

@ -27,13 +27,8 @@ LDAP User Sync
<div class="box-body"> <div class="box-body">
<!-- location_id--> <!-- location_id-->
<div class="form-group {{ $errors->has('location_id') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('location_id') ? 'has-error' : '' }}">
<label class="col-md-2 control-label" for="location_id">{{ trans('admin/users/table.location') }} <!-- Location -->
</label> @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
<div class="col-md-6">
{{ Form::select('location_id', $location_list , Input::old('location_id'), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('location_id', '<span class="alert-msg">:message</span>') !!}
</div>
<div class="col-md-4"> <div class="col-md-4">
<button type="submit" class="btn btn-warning" id="sync"> <button type="submit" class="btn btn-warning" id="sync">
<i id="sync-button-icon" class="fa fa-refresh icon-white"></i> <span id="sync-button-text">Synchronize</span> <i id="sync-button-icon" class="fa fa-refresh icon-white"></i> <span id="sync-button-text">Synchronize</span>

View file

@ -47,12 +47,13 @@ Route::group(['prefix' => 'v1','namespace' => 'Api'], function () {
Route::group(['prefix' => 'categories'], function () { Route::group(['prefix' => 'categories'], function () {
Route::get('selectlist', Route::get('{item_type}/selectlist',
[ [
'as' => 'api.categories.selectlist', 'as' => 'api.categories.selectlist',
'uses' => 'CategoriesController@selectlist' 'uses' => 'CategoriesController@selectlist'
] ]
); );
}); // Categories group }); // Categories group