Compare commits

...

13 Commits

Author SHA1 Message Date
snipe 1f36e7997f Bumped version 2017-12-20 03:31:43 -08:00
snipe 33b5c26da5 Bumped hashcount 2017-12-19 22:16:31 -08:00
snipe e5a7e6619f Merge branch 'develop' 2017-12-19 22:15:51 -08:00
snipe d2e2c1c05f Stub and 404 registration routes 2017-12-19 22:14:51 -08:00
snipe 557b8b0ded Merge branch 'develop' 2017-12-19 20:57:46 -08:00
snipe 37d4cf3afb Fixed #4647 - requestable model button not clickable 2017-12-19 20:48:26 -08:00
snipe b716db225f Added “new” buttons for manufacturer and category in asset model creation 2017-12-19 20:30:46 -08:00
snipe fbe093705d Fixed #4640 - add username to user detail 2017-12-19 13:42:34 -08:00
snipe db278e9109 Merge branch 'develop' 2017-12-19 00:48:44 -08:00
snipe 88798435f6 Fixed inefficient query for inventory alerts 2017-12-19 00:32:39 -08:00
snipe 6220f0d8a5 Merge branch 'develop'
# Conflicts:
#	config/version.php
2017-12-15 18:57:21 -08:00
snipe 30716b349b Bumped dev hash 2017-12-15 18:55:56 -08:00
snipe 7a8c8233a2 Fixes #4639 2017-12-15 18:54:38 -08:00
14 changed files with 154 additions and 52 deletions
+12 -12
View File
@@ -460,19 +460,19 @@ class Helper
*/
public static function checkLowInventory()
{
$consumables = Consumable::with('users')->whereNotNull('min_amt')->get();
$accessories = Accessory::with('users')->whereNotNull('min_amt')->get();
$components = Component::with('assets')->whereNotNull('min_amt')->get();
$consumables = Consumable::withCount('consumableAssignments')->whereNotNull('min_amt')->get();
$accessories = Accessory::withCount('users')->whereNotNull('min_amt')->get();
$components = Component::withCount('assets')->whereNotNull('min_amt')->get();
$avail_consumables = 0;
$items_array = array();
$all_count = 0;
foreach ($consumables as $consumable) {
$avail = $consumable->numRemaining();
$avail = $consumable->qty - $consumable->consumable_assignment_count; //$consumable->numRemaining();
if ($avail < ($consumable->min_amt) + \App\Models\Setting::getSettings()->alert_threshold) {
if ($consumable->qty > 0) {
$percent = number_format((($consumable->numRemaining() / $consumable->qty) * 100), 0);
$percent = number_format((($avail / $consumable->qty) * 100), 0);
} else {
$percent = 100;
}
@@ -481,7 +481,7 @@ class Helper
$items_array[$all_count]['name'] = $consumable->name;
$items_array[$all_count]['type'] = 'consumables';
$items_array[$all_count]['percent'] = $percent;
$items_array[$all_count]['remaining']=$consumable->numRemaining();
$items_array[$all_count]['remaining'] = $avail;
$items_array[$all_count]['min_amt']=$consumable->min_amt;
$all_count++;
}
@@ -490,11 +490,11 @@ class Helper
}
foreach ($accessories as $accessory) {
$avail = $accessory->numRemaining();
$avail = $accessory->qty - $accessory->users_count;
if ($avail < ($accessory->min_amt) + \App\Models\Setting::getSettings()->alert_threshold) {
if ($accessory->qty > 0) {
$percent = number_format((($accessory->numRemaining() / $accessory->qty) * 100), 0);
$percent = number_format((($avail / $accessory->qty) * 100), 0);
} else {
$percent = 100;
}
@@ -503,7 +503,7 @@ class Helper
$items_array[$all_count]['name'] = $accessory->name;
$items_array[$all_count]['type'] = 'accessories';
$items_array[$all_count]['percent'] = $percent;
$items_array[$all_count]['remaining']=$accessory->numRemaining();
$items_array[$all_count]['remaining'] = $avail;
$items_array[$all_count]['min_amt']=$accessory->min_amt;
$all_count++;
}
@@ -511,10 +511,10 @@ class Helper
}
foreach ($components as $component) {
$avail = $component->numRemaining();
$avail = $component->qty - $component->assets_count;
if ($avail < ($component->min_amt) + \App\Models\Setting::getSettings()->alert_threshold) {
if ($component->qty > 0) {
$percent = number_format((($component->numRemaining() / $component->qty) * 100), 0);
$percent = number_format((($avail / $component->qty) * 100), 0);
} else {
$percent = 100;
}
@@ -523,7 +523,7 @@ class Helper
$items_array[$all_count]['name'] = $component->name;
$items_array[$all_count]['type'] = 'components';
$items_array[$all_count]['percent'] = $percent;
$items_array[$all_count]['remaining']=$component->numRemaining();
$items_array[$all_count]['remaining'] = $avail;
$items_array[$all_count]['min_amt']=$component->min_amt;
$all_count++;
}
@@ -35,10 +35,7 @@ class CompaniesController extends Controller
'components_count',
];
$companies = Company::withCount('assets','licenses','accessories','consumables','components','users')
->withCount('users')->withCount('assets')
->withCount('licenses')->withCount('accessories')
->withCount('consumables')->withCount('components');
$companies = Company::withCount('assets','licenses','accessories','consumables','components','users');
if ($request->has('search')) {
$companies->TextSearch($request->input('search'));
@@ -12,4 +12,12 @@ class RegisterController extends Controller
{
$this->middleware('guest');
}
public function showRegistrationForm() {
abort(404,'Page not found');
}
public function register() {
abort(404,'Page not found');
}
}
+9
View File
@@ -29,4 +29,13 @@ class ModalController extends Controller
function user() {
return view('modals.user');
}
function category() {
return view('modals.category');
}
function manufacturer() {
return view('modals.manufacturer');
}
}
+6 -6
View File
@@ -166,31 +166,31 @@ final class Company extends SnipeModel
public function users()
{
return $this->hasMany(User::class, 'users.company_id');
return $this->hasMany(User::class, 'company_id');
}
public function assets()
{
return $this->hasMany(Asset::class, 'assets.company_id');
return $this->hasMany(Asset::class, 'company_id');
}
public function licenses()
{
return $this->hasMany(License::class, 'licenses.company_id');
return $this->hasMany(License::class, 'company_id');
}
public function accessories()
{
return $this->hasMany(Accessory::class, 'accessories.company_id');
return $this->hasMany(Accessory::class, 'company_id');
}
public function consumables()
{
return $this->hasMany(Consumable::class, 'consumables.company_id');
return $this->hasMany(Consumable::class, 'company_id');
}
public function components()
{
return $this->hasMany(Component::class, 'components.company_id');
return $this->hasMany(Component::class, 'company_id');
}
/**
+5 -5
View File
@@ -1,10 +1,10 @@
<?php
return array (
'app_version' => 'v4.1.8',
'full_app_version' => 'v4.1.8-pre - build 3106-geb827cd',
'build_version' => '3106',
'app_version' => 'v4.1.9',
'full_app_version' => 'v4.1.9 - build 3128-ge5a7e66',
'build_version' => '3128',
'prerelease_version' => '',
'hash_version' => 'geb827cd',
'full_hash' => 'v4.1.7-69-geb827cd',
'hash_version' => 'ge5a7e66',
'full_hash' => 'v4.1.8-11-ge5a7e66',
'branch' => 'master',
);
@@ -143,19 +143,17 @@
<th class="col-md-1" data-sortable="true">{{ trans('general.image') }}</th>
<th class="col-md-6" data-sortable="true">{{ trans('admin/hardware/table.asset_model') }}</th>
<th class="col-md-3" data-sortable="true">{{ trans('admin/accessories/general.remaining') }}</th>
<th class="col-md-2" data-sortable="true">{{ trans('general.quantity') }}</th>
<th class="col-md-1 actions" data-sortable="false">{{ trans('table.actions') }}</th>
<th class="col-md-2 actions" data-sortable="false">{{ trans('table.actions') }}</th>
</tr>
</thead>
<tbody>
@foreach($models as $requestableModel)
<tr>
<form action="{{route('account/request-item', ['itemType' => 'asset_model', 'itemId' => $requestableModel->id])}}"
method="POST"
accept-charset="utf-8">
{{ csrf_field() }}
<td>
@if ($requestableModel->image)
<a href="{{ url('/') }}/uploads/models/{{ $requestableModel->image }}" data-toggle="lightbox" data-type="image">
<img src="{{ url('/') }}/uploads/models/{{ $requestableModel->image }}" style="max-height: {{ $snipeSettings->thumbnail_max_h }}px; width: auto;" class="img-responsive">
@@ -167,16 +165,20 @@
<td>{{$requestableModel->name}}</td>
<td>{{$requestableModel->assets->where('requestable', '1')->count()}}</td>
<td><input type="text" name="request-quantity" value=""></td>
<td>
<form action="{{route('account/request-item', ['itemType' => 'asset_model', 'itemId' => $requestableModel->id])}}" method="POST" accept-charset="utf-8">
{{ csrf_field() }}
<input type="text" style="width: 70px; margin-right: 10px;" class="form-control pull-left" name="request-quantity" value="" placeholder="{{ trans('general.qty') }}">
@if ($requestableModel->isRequestedBy(Auth::user()))
{{Form::submit(trans('button.cancel'), ['class' => 'btn btn-danger btn-sm'])}}
{{ Form::submit(trans('button.cancel'), ['class' => 'btn btn-danger btn-sm'])}}
@else
{{Form::submit(trans('button.request'), ['class' => 'btn btn-primary btn-sm'])}}
{{ Form::submit(trans('button.request'), ['class' => 'btn btn-primary btn-sm'])}}
@endif
</form>
</td>
</form>
</tr>
@endforeach
</tbody>
</table>
@@ -6,9 +6,9 @@
<p>{{ trans('mail.user') }} <a href="{{ route('users.show', $user_id) }}">{{ $requested_by }}</a><br>
{{ trans('mail.item') }} <a href="{{ $item_url }}">{{ $item_name }}</a> ({{ $item_type }}) <br>
{{ trans('mail.requested') }} {{ $requested_date }}
{{ trans('general.requested') }} {{ $requested_date }}
@if ($item_quantity > 1)
{{ trans('mail.quantity') }} {{ $item_quantity}}
<br> {{ trans('general.qty') }} {{ $item_quantity}}
@endif
@if ($snipeSettings->show_url_in_emails=='1')
+39
View File
@@ -0,0 +1,39 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{{ trans('admin/categories/general.create') }}</h4>
</div>
<div class="modal-body">
<div class="alert alert-danger" id="modal_error_msg" style="display:none">
</div>
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-name">{{ trans('general.name') }}:
</label></div>
<div class="col-md-8 col-xs-12 required">
<input type='text' id='modal-name' class="form-control">
</div>
</div>
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-name">{{ trans('general.name') }}:
</label></div>
<div class="col-md-8 col-xs-12 required">
<select class="select2" id="modal-category_type" style="width: 100%">
<option value="asset">Asset</option>
<option value="accessory" disabled>Accessory</option>
<option value="consumable" disabled>Consumable</option>
<option value="component" disabled>Component</option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('button.cancel') }}</button>
<button type="button" class="btn btn-primary" id="modal-save">{{ trans('general.save') }}</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
@@ -0,0 +1,25 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{{ trans('admin/manufacturers/table.create') }}</h4>
</div>
<div class="modal-body">
<div class="alert alert-danger" id="modal_error_msg" style="display:none">
</div>
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-name">{{ trans('general.name') }}:
</label></div>
<div class="col-md-8 col-xs-12 required">
<input type='text' id='modal-name' class="form-control">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('button.cancel') }}</button>
<button type="button" class="btn btn-primary" id="modal-save">{{ trans('general.save') }}</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
@@ -15,6 +15,13 @@
</select>
</div>
<div class="col-md-1 col-sm-1 text-left">
@can('create', \App\Models\Category::class)
@if ((!isset($hide_new)) || ($hide_new!='true'))
<a href='{{ route('modal.category') }}' data-toggle="modal" data-target="#createModal" data-dependency="categorie" data-select='category_select_id' class="btn btn-sm btn-default">New</a>
@endif
@endcan
</div>
{!! $errors->first($fieldname, '<div class="col-md-8 col-md-offset-3"><span class="alert-msg"><i class="fa fa-times"></i> :message</span></div>') !!}
@@ -4,7 +4,7 @@
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7{{ ((isset($required)) && ($required=='true')) ? ' required' : '' }}">
<select class="js-data-ajax" data-endpoint="manufacturers" name="{{ $fieldname }}" style="width: 100%" id="category_select_id">
<select class="js-data-ajax" data-endpoint="manufacturers" name="{{ $fieldname }}" style="width: 100%" id="manufacturer_select_id">
@if ($manufacturer_id = Input::old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
<option value="{{ $manufacturer_id }}" selected="selected">
{{ (\App\Models\Manufacturer::find($manufacturer_id)) ? \App\Models\Manufacturer::find($manufacturer_id)->name : '' }}
@@ -16,6 +16,14 @@
</select>
</div>
<div class="col-md-1 col-sm-1 text-left">
@can('create', \App\Models\Manufacturer::class)
@if ((!isset($hide_new)) || ($hide_new!='true'))
<a href='{{ route('modal.manufacturer') }}' data-toggle="modal" data-target="#createModal" data-dependency="manufacturer" data-select='manufacturer_select_id' class="btn btn-sm btn-default">New</a>
@endif
@endcan
</div>
{!! $errors->first($fieldname, '<div class="col-md-8 col-md-offset-3"><span class="alert-msg"><i class="fa fa-times"></i> :message</span></div>') !!}
</div>
+17 -12
View File
@@ -136,20 +136,12 @@
<td>{{ trans('admin/users/table.name') }}</td>
<td>{{ $user->present()->fullName() }}</td>
</tr>
<tr>
<td>{{ trans('admin/users/table.username') }}</td>
<td>{{ $user->username }}</td>
</tr>
@if ($user->last_login)
<tr>
<td>{{ trans('general.last_login') }}</td>
<td>{{ \App\Helpers\Helper::getFormattedDateObject($user->last_login, 'datetime', false) }}</td>
</tr>
@endif
@if (!is_null($user->department))
<tr>
<td>{{ trans('general.department') }}</td>
<td><a href="{{ route('departments.show', $user->department) }}">{{ $user->department->name }}</a></td>
</tr>
@endif
@if ($user->jobtitle)
<tr>
@@ -197,6 +189,19 @@
</tr>
@endif
@if ($user->last_login)
<tr>
<td>{{ trans('general.last_login') }}</td>
<td>{{ \App\Helpers\Helper::getFormattedDateObject($user->last_login, 'datetime', false) }}</td>
</tr>
@endif
@if (!is_null($user->department))
<tr>
<td>{{ trans('general.department') }}</td>
<td><a href="{{ route('departments.show', $user->department) }}">{{ $user->department->name }}</a></td>
</tr>
@endif
@if ($user->created_at)
<tr>
<td>{{ trans('general.created_at') }}</td>
+2
View File
@@ -82,6 +82,8 @@ Route::group(['middleware' => 'auth'], function () {
Route::group(['middleware' => 'auth','prefix' => 'modals'], function () {
Route::get('location',['as' => 'modal.location','uses' => 'ModalController@location']);
Route::get('category',['as' => 'modal.category','uses' => 'ModalController@category']);
Route::get('manufacturer',['as' => 'modal.manufacturer','uses' => 'ModalController@manufacturer']);
Route::get('model',['as' => 'modal.model','uses' => 'ModalController@model']);
Route::get('statuslabel',['as' => 'modal.statuslabel','uses' => 'ModalController@statuslabel']);
Route::get('supplier',['as' => 'modal.supplier','uses' => 'ModalController@supplier']);