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)
{
$this->authorize('create', Accessory::class);
// Show the page
return view('accessories/edit')
$category_type = 'accessory';
return view('accessories/edit')->with('category_type', $category_type)
->with('item', new Accessory);
}
@ -125,14 +125,15 @@ class AccessoriesController extends Controller
*/
public function edit(Request $request, $accessoryId = null)
{
// Check if the accessory exists
if (is_null($item = Accessory::find($accessoryId))) {
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.does_not_exist'));
if ($item = Accessory::find($accessoryId)) {
$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
*
*/
public function selectlist(Request $request)
public function selectlist(Request $request, $category_type = 'asset')
{
$this->authorize('view', Categories::class);
@ -153,7 +153,7 @@ class CategoriesController extends Controller
$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.
// 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);
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('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);
foreach ($users as $user) {
$name_str = '';
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.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see AssetModelsController::getDatatable() method that generates the JSON response
* @since [v1.0]
* @return View
*/
@ -53,11 +52,9 @@ class AssetModelsController extends Controller
*/
public function create()
{
// Show the page
return view('models/edit')
->with('category_list', Helper::categoryList('asset'))
$category_type = 'asset';
return view('models/edit')->with('category_type',$category_type)
->with('depreciation_list', Helper::depreciationList())
->with('manufacturer_list', Helper::manufacturerList())
->with('item', new AssetModel);
}
@ -165,17 +162,15 @@ class AssetModelsController extends Controller
*/
public function edit($modelId = null)
{
// Check if the model exists
if (is_null($item = AssetModel::find($modelId))) {
// Redirect to the model management page
return redirect()->route('models.index')->with('error', trans('admin/models/message.does_not_exist'));
if ($item = AssetModel::find($modelId)) {
$category_type = 'asset';
$view = View::make('models/edit', compact('item','category_type'));
$view->with('depreciation_list', Helper::depreciationList());
return $view;
}
$view = View::make('models/edit', compact('item'));
$view->with('category_list', Helper::categoryList('asset'));
$view->with('depreciation_list', Helper::depreciationList());
$view->with('manufacturer_list', Helper::manufacturerList());
return $view;
return redirect()->route('models.index')->with('error', trans('admin/models/message.does_not_exist'));
}

View file

@ -255,14 +255,8 @@ class AssetsController extends Controller
return view('hardware/edit', compact('item'))
->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('assigned_to', Helper::usersList())
->with('manufacturer', Helper::manufacturerList())
->with('statuslabel_types', Helper::statusTypeList())
->with('category', Helper::categoryList('asset'));
->with('statuslabel_types', Helper::statusTypeList());
}
@ -720,18 +714,9 @@ class AssetsController extends Controller
$asset->assigned_to = '';
return view('hardware/edit')
->with('supplier_list', Helper::suppliersList())
->with('model_list', Helper::modelList())
->with('statuslabel_list', Helper::statusLabelList())
->with('statuslabel_types', Helper::statusTypeList())
->with('assigned_to', Helper::usersList())
->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());
->with('item', $asset);
}
/**
@ -1035,8 +1020,7 @@ class AssetsController extends Controller
return view('hardware/labels')
->with('assets', Asset::find($asset_ids))
->with('settings', Setting::getSettings())
->with('count', $count)
->with('settings', Setting::getSettings());
->with('count', $count);
} elseif ($request->input('bulk_actions')=='delete') {
$assets = Asset::with('assignedTo', 'location')->find($asset_ids);
$assets->each(function ($asset) {
@ -1047,10 +1031,7 @@ class AssetsController extends Controller
} elseif ($request->input('bulk_actions')=='edit') {
return view('hardware/bulk')
->with('assets', request('ids'))
->with('supplier_list', Helper::suppliersList())
->with('statuslabel_list', Helper::statusLabelList())
->with('location_list', Helper::locationsList())
->with('models_list', Helper::modelList())
->with(
'companies_list',
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);
$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);
$dt = Carbon::now()->addMonths(12)->toDateString();
$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)

View file

@ -59,8 +59,8 @@ class ComponentsController extends Controller
public function create()
{
$this->authorize('create', Component::class);
// Show the page
return view('components/edit')
$category_type = 'component';
return view('components/edit')->with('category_type',$category_type)
->with('item', new Component);
}
@ -118,14 +118,18 @@ class ComponentsController extends Controller
*/
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()
{
$this->authorize('create', Consumable::class);
// Show the page
return view('consumables/edit')
$category_type = 'consumable';
return view('consumables/edit')->with('category_type', $category_type)
->with('item', new Consumable);
}
@ -119,17 +119,14 @@ class ConsumablesController extends Controller
*/
public function edit($consumableId = null)
{
if (is_null($item = Consumable::find($consumableId))) {
return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.does_not_exist'));
if ($item = Consumable::find($consumableId)) {
$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()
{
return view('departments/edit')->with('item', new Department)
->with('manager_list', Helper::managerList())
->with('location_list', Helper::locationsList())
->with('company_list', Helper::companyList());
return view('departments/edit')->with('item', new Department);
}
@ -144,10 +141,7 @@ class DepartmentsController extends Controller
if (is_null($item = Department::find($id))) {
return redirect()->back()->with('error', trans('admin/locations/message.does_not_exist'));
}
return view('departments/edit', compact('item'))
->with('manager_list', Helper::managerList())
->with('location_list', Helper::locationsList())
->with('company_list', Helper::companyList());
return view('departments/edit', compact('item'));
}
public function update(Request $request, $id) {

View file

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

View file

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

View file

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

View file

@ -55,7 +55,8 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
'username' => 'required|string|min:1|unique_undeleted',
'email' => 'email|nullable',
'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' : '' }}">
<label for="first_name" class="col-md-3 control-label">{{ trans('general.first_name') }}
</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) }}" />
{!! $errors->first('first_name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
@ -30,24 +30,15 @@
<label for="last_name" class="col-md-3 control-label">
{{ trans('general.last_name') }}
</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) }}" />
{!! $errors->first('last_name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Location -->
<div class="form-group {{ $errors->has('location_id') ? 'error' : '' }}">
<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>
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
<!-- Language -->
<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}">
@ -62,7 +53,7 @@
<!-- Website URL -->
<div class="form-group {{ $errors->has('website') ? ' has-error' : '' }}">
<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) }}" />
{!! $errors->first('website', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
@ -73,7 +64,7 @@
<label for="gravatar" class="col-md-3 control-label">{{ trans('general.gravatar_email') }}
<small>(Private)</small>
</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) }}" />
{!! $errors->first('gravatar', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
<p>
@ -87,7 +78,7 @@
@if ($user->avatar)
<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>
<div class="col-md-5">
<div class="col-md-8">
{{ Form::checkbox('avatar_delete') }}
<img src="{{ url('/') }}/uploads/avatars/{{ $user->avatar }}" class="avatar img-circle">
{!! $errors->first('avatar_delete', '<span class="alert-msg">:message</span>') !!}
@ -97,7 +88,7 @@
<div class="form-group {{ $errors->has('avatar') ? 'has-error' : '' }}">
<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') }}
{!! $errors->first('avatar', '<span class="alert-msg">:message</span>') !!}
</div>

View file

@ -11,26 +11,17 @@
@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 -->
<div class="form-group {{ $errors->has('manager_id') ? 'has-error' : '' }}">
<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>
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
<!-- Location -->
<div class="form-group {{ $errors->has('location_id') ? 'has-error' : '' }}">
<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>
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
<!-- Image -->
@if ($item->image)

View file

@ -45,14 +45,7 @@
</div>
<!-- Locations -->
<div id="location_id" class="form-group{{ $errors->has('location_id') ? ' has-error' : '' }}">
{{ 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>
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
<!-- Next Audit -->

View file

@ -30,7 +30,7 @@
<div class="box-body">
<!-- Purchase Date -->
<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">
<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>
@ -40,7 +40,7 @@
<!-- Status -->
<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') }}
</label>
<div class="col-md-7">
@ -49,31 +49,15 @@
</div>
</div>
<!-- Asset Model -->
<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>
@include ('partials.forms.edit.model-select', ['translated_name' => trans('admin/hardware/form.model'), 'fieldname' => 'model_id'])
<!-- Default Location -->
<div class="form-group {{ $errors->has('status_id') ? ' has-error' : '' }}">
<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>
@include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/hardware/form.default_location'), 'fieldname' => 'location_id'])
<!-- Purchase Cost -->
<!-- Purchase Cost -->
<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') }}
</label>
<div class="input-group col-md-3">
@ -84,19 +68,12 @@
</div>
<!-- Supplier -->
<div class="form-group {{ $errors->has('supplier_id') ? ' has-error' : '' }}">
<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>
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
<!-- Company -->
<!-- Company -->
<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') }}
</label>
<div class="col-md-7">
@ -107,7 +84,7 @@
<!-- Order Number -->
<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') }}
</label>
<div class="col-md-7">
@ -118,12 +95,12 @@
<!-- Warranty -->
<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') }}
</label>
<div class="col-md-2">
<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>
{!! $errors->first('warranty_months', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
@ -132,10 +109,10 @@
<!-- Requestable -->
<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') }}
</label>
<div class="col-md-10">
<div class="col-md-7 col-md-offset-3">
<label class="radio">
<input type="radio" name="requestable" value="1"> Yes
</label>

View file

@ -43,14 +43,7 @@
<!-- Locations -->
<div id="location_id" class="form-group{{ $errors->has('location_id') ? ' has-error' : '' }}">
{{ 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>
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
<!-- Next Audit -->

View file

@ -22,15 +22,7 @@
</div>
<!-- Manager-->
<div class="form-group {{ $errors->has('manager_id') ? ' has-error' : '' }}">
<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>
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
<!-- Currency -->
<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')) }}
<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}))
<option value="{{ $category_id }}" selected="selected">
{{ \App\Models\Category::find($category_id)->name }}

View file

@ -5,7 +5,7 @@
<div class="col-md-7 required">
<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">
{{ \App\Models\AssetModel::find($model_id)->name }}
</option>

View file

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

View file

@ -4,9 +4,9 @@
<div class="col-md-7 required">
<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">
{{ \App\Models\User::find($user_id)->name }}
{{ \App\Models\User::find($user_id)->present()->fullName }}
</option>
@else
<option value="">{{ trans('general.select_user') }}</option>

View file

@ -30,50 +30,21 @@
<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 -->
<div class="form-group {{ $errors->has('department_id') ? ' has-error' : '' }}">
<label for="status_id" class="col-md-3 control-label">
{{ trans('general.department') }}
</label>
<div class="col-md-7">
{{ 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>
@include ('partials.forms.edit.department-select', ['translated_name' => trans('general.department'), 'fieldname' => 'department_id'])
<!-- Location -->
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
<!-- Company -->
<div class="form-group {{ $errors->has('company_id') ? ' has-error' : '' }}">
<label for="company_id" class="col-md-3 control-label">
{{ trans('general.company') }}
</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>
@if (\App\Models\Company::canManageUsersCompanies())
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.select_company'), 'fieldname' => 'company_id'])
@endif
<!-- manager -->
<div class="form-group {{ $errors->has('manager_id') ? ' has-error' : '' }}">
<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>
<!-- Manager -->
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
<!-- activated -->
<div class="form-group">

View file

@ -178,6 +178,8 @@
class="form-control"
value=""
autocomplete="off"
readonly
onfocus="this.removeAttribute('readonly');"
{{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }}
>
@if (config('app.lock_passwords') && ($user->id))
@ -256,14 +258,14 @@
<!-- 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 -->
@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 -->
@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 -->
<div class="form-group {{ $errors->has('phone') ? 'has-error' : '' }}">

View file

@ -27,13 +27,8 @@ LDAP User Sync
<div class="box-body">
<!-- location_id-->
<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') }}
</label>
<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>
<!-- Location -->
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
<div class="col-md-4">
<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>

View file

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