Merge branch 'develop'

This commit is contained in:
snipe 2017-12-04 20:43:24 -08:00
commit 18c1b2b477
13 changed files with 82 additions and 13 deletions

View file

@ -188,17 +188,19 @@ class AssetModelsController extends Controller
'models.name',
'models.image',
'models.model_number',
])->with('manufacturer');
'models.manufacturer_id',
'models.category_id',
])->with('manufacturer','category');
if ($request->has('search')) {
$assetmodels = $assetmodels->where('models.name', 'LIKE', '%'.$request->get('search').'%')
->orWhere('models.model_number', 'LIKE', '%'.$request->get('search').'%');
$assetmodels = $assetmodels->SearchByManufacturerOrCat($request->input('search'));
}
$assetmodels = $assetmodels->orderby('models.name', 'asc')->orderby('models.model_number', 'asc')->paginate(50);
$assetmodels = $assetmodels->OrderCategory('ASC')->OrderManufacturer('ASC')->orderby('models.name', 'asc')->orderby('models.model_number', 'asc')->paginate(50);
foreach ($assetmodels as $assetmodel) {
$assetmodel->use_text = $assetmodel->present()->modelName;
$assetmodel->use_text = (($assetmodel->category) ? e($assetmodel->category->name) : '').': '.(($assetmodel->manufacturer) ? e($assetmodel->manufacturer->name) : '').' '.$assetmodel->present()->modelName;
$assetmodel->use_image = ($assetmodel->image) ? url('/').'/uploads/models/'.$assetmodel->image : null;
}

View file

@ -817,6 +817,8 @@ class Asset extends Depreciable
->orWhere('assets.asset_tag', 'LIKE', '%'.$search.'%')
->orWhere('assets.serial', 'LIKE', '%'.$search.'%')
->orWhere('assets.order_number', 'LIKE', '%'.$search.'%')
->orWhere('assets.purchase_date', 'LIKE', '%'.$search.'%')
->orWhere('assets.purchase_cost', 'LIKE', '%'.$search.'%')
->orWhere('assets.notes', 'LIKE', '%'.$search.'%');
}
foreach (CustomField::all() as $field) {

View file

@ -169,6 +169,32 @@ class AssetModel extends SnipeModel
}
/**
* Query builder scope to search on text, including catgeory and manufacturer name
*
* @param Illuminate\Database\Query\Builder $query Query builder instance
* @param text $search Search term
*
* @return Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeSearchByManufacturerOrCat($query, $search)
{
return $query->where('models.name', 'LIKE', "%$search%")
->orWhere('model_number', 'LIKE', "%$search%")
->orWhere(function ($query) use ($search) {
$query->whereHas('category', function ($query) use ($search) {
$query->where('categories.name', 'LIKE', '%'.$search.'%');
});
})
->orWhere(function ($query) use ($search) {
$query->whereHas('manufacturer', function ($query) use ($search) {
$query->where('manufacturers.name', 'LIKE', '%'.$search.'%');
});
});
}
/**
* Query builder scope to order on manufacturer
*
@ -182,5 +208,18 @@ class AssetModel extends SnipeModel
return $query->leftJoin('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id')->orderBy('manufacturers.name', $order);
}
/**
* Query builder scope to order on category name
*
* @param \Illuminate\Database\Query\Builder $query Query builder instance
* @param text $order Order
*
* @return \Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeOrderCategory($query, $order)
{
return $query->leftJoin('categories', 'models.category_id', '=', 'categories.id')->orderBy('categories.name', $order);
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
public/js/dist/all.js vendored

Binary file not shown.

View file

@ -2,13 +2,13 @@
"/js/build/vue.js": "/js/build/vue.js?id=e6804371942215bd1d7d",
"/css/AdminLTE.css": "/css/AdminLTE.css?id=b8be19a285eaf44eec37",
"/css/app.css": "/css/app.css?id=407edb63cc6b6dc62405",
"/css/overrides.css": "/css/overrides.css?id=a4994a56ec31f2099730",
"/css/overrides.css": "/css/overrides.css?id=ca0621c2a909d165534d",
"/js/build/vue.js.map": "/js/build/vue.js.map?id=3b3d417664a61dcce3e9",
"/css/AdminLTE.css.map": "/css/AdminLTE.css.map?id=99f5a5a03c4155cf69f6",
"/css/app.css.map": "/css/app.css.map?id=bdbe05e6ecd70ccfac72",
"/css/overrides.css.map": "/css/overrides.css.map?id=898c91d4a425b01b589b",
"/css/dist/all.css": "/css/dist/all.css?id=277aaa6291c83cc8204f",
"/js/dist/all.js": "/js/dist/all.js?id=7b52ead3a55086ea1f8d",
"/css/build/all.css": "/css/build/all.css?id=277aaa6291c83cc8204f",
"/js/build/all.js": "/js/build/all.js?id=7b52ead3a55086ea1f8d"
"/css/dist/all.css": "/css/dist/all.css?id=51e5995cec7ce583f5dd",
"/js/dist/all.js": "/js/dist/all.js?id=88f08e0103b14f7949b3",
"/css/build/all.css": "/css/build/all.css?id=51e5995cec7ce583f5dd",
"/js/build/all.js": "/js/build/all.js?id=88f08e0103b14f7949b3"
}

View file

@ -241,9 +241,9 @@ $(document).ready(function () {
var markup = "<div class='clearfix'>" ;
markup +="<div class='pull-left' style='padding-right: 10px;'>";
if (datalist.image) {
markup += "<img src='" + datalist.image + "' style='max-height: 20px'>";
markup += "<div style='width: 30px;'><img src='" + datalist.image + "' style='max-height: 20px; max-width: 30px;'></div>";
} else {
markup += "<div style='height: 20px; width: 20px;'></div>";
markup += "<div style='height: 20px; width: 30px;'></div>";
}
markup += "</div><div>" + datalist.text + "</div>";

View file

@ -318,3 +318,7 @@ img.navbar-brand-img, .navbar-brand>img {
.input-daterange {
border-radius: 0px;
}
.btn.bg-maroon, .btn.bg-purple{
min-width:90px;
}

View file

@ -38,7 +38,7 @@
<!-- Location -->
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
@include ('partials.forms.edit.location-profile-select', ['translated_name' => trans('general.location')])
<!-- Language -->
<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}">

View file

@ -0,0 +1,22 @@
<!-- Location -->
<div id="location_id" class="form-group{{ $errors->has('location_id') ? ' has-error' : '' }}"{!! (isset($style)) ? ' style="'.e($style).'"' : '' !!}>
{{ Form::label('location_id', $translated_name, array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7">
<select class="js-data-ajax" data-endpoint="locations" name="location_id" style="width: 100%" id="location_id_location_select">
@if ($location_id = Input::old('location_id', (isset($user)) ? $user->location_id : ''))
<option value="{{ $location_id }}" selected="selected">
{{ (\App\Models\Location::find($location_id)) ? \App\Models\Location::find($location_id)->name : '' }}
</option>
@else
<option value="">{{ trans('general.select_location') }}</option>
@endif
</select>
</div>
{!! $errors->first('location_id', '<div class="col-md-8 col-md-offset-3"><span class="alert-msg"><i class="fa fa-times"></i> :message</span></div>') !!}
</div>