Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1f36e7997f | |||
| 33b5c26da5 | |||
| e5a7e6619f | |||
| d2e2c1c05f | |||
| 557b8b0ded | |||
| 37d4cf3afb | |||
| b716db225f | |||
| fbe093705d | |||
| db278e9109 | |||
| 88798435f6 | |||
| 6220f0d8a5 | |||
| 30716b349b | |||
| 7a8c8233a2 |
+12
-12
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
@@ -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')
|
||||
|
||||
@@ -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">×</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">×</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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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']);
|
||||
|
||||
Reference in New Issue
Block a user