mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
Merge branch 'develop' into snipeit_v7
This commit is contained in:
commit
70e87dad1c
|
@ -42,6 +42,11 @@ class LicenseSeatsController extends Controller
|
|||
|
||||
// Make sure the offset and limit are actually integers and do not exceed system limits
|
||||
$offset = ($request->input('offset') > $seats->count()) ? $seats->count() : abs($request->input('offset'));
|
||||
|
||||
if ($offset >= $total ){
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
$limit = app('api_limit_value');
|
||||
|
||||
$seats = $seats->skip($offset)->take($limit)->get();
|
||||
|
|
|
@ -774,7 +774,7 @@ class AssetsController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Retore a deleted asset.
|
||||
* Restore a deleted asset.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $assetId
|
||||
|
|
|
@ -390,7 +390,7 @@ class Asset extends Depreciable
|
|||
*/
|
||||
public function depreciation()
|
||||
{
|
||||
return $this->model->belongsTo(\App\Models\Depreciation::class, 'depreciation_id');
|
||||
return $this->hasOneThrough(\App\Models\Depreciation::class,\App\Models\AssetModel::class,'id','id','model_id','depreciation_id');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ return [
|
|||
'clone' => 'Clone Asset',
|
||||
'deployable' => 'Deployable',
|
||||
'deleted' => 'This asset has been deleted.',
|
||||
'delete_confirm' => 'Are you sure you want to delete this asset?',
|
||||
'edit' => 'Edit Asset',
|
||||
'model_deleted' => 'This Assets model has been deleted. You must restore the model before you can restore the Asset.',
|
||||
'model_invalid' => 'The Model of this Asset is invalid.',
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
return array(
|
||||
|
||||
'does_not_exist' => 'Model does not exist.',
|
||||
'no_association' => 'NO MODEL ASSOCIATED.',
|
||||
'no_association' => 'WARNING! The asset model for this item is invalid or missing!',
|
||||
'no_association_fix' => 'This will break things in weird and horrible ways. Edit this asset now to assign it a model.',
|
||||
'assoc_users' => 'This model is currently associated with one or more assets and cannot be deleted. Please delete the assets, and then try deleting again. ',
|
||||
|
||||
|
|
|
@ -264,7 +264,7 @@ return [
|
|||
'accept_eula' => 'Acceptance Agreement',
|
||||
'supplier' => 'Supplier',
|
||||
'suppliers' => 'Suppliers',
|
||||
'sure_to_delete' => 'Are you sure you wish to delete',
|
||||
'sure_to_delete' => 'Are you sure you wish to delete',
|
||||
'submit' => 'Submit',
|
||||
'target' => 'Target',
|
||||
'time_and_date_display' => 'Time and Date Display',
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
</span>
|
||||
</td>
|
||||
@endcan
|
||||
<td class="index">{{$field->pivot->order}}</td>
|
||||
<td class="index">{{$field->pivot->order + 1}}</td>
|
||||
<td>{{$field->name}}</td>
|
||||
<td>{{$field->format}}</td>
|
||||
<td>{{$field->element}}</td>
|
||||
|
|
|
@ -6,67 +6,6 @@
|
|||
@parent
|
||||
@stop
|
||||
|
||||
{{-- Right header --}}
|
||||
@section('header_right')
|
||||
|
||||
|
||||
@can('manage', \App\Models\Asset::class)
|
||||
@if ($asset->deleted_at=='')
|
||||
<div class="dropdown pull-right">
|
||||
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">{{ trans('button.actions') }}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" role="menu">
|
||||
|
||||
@if (($asset->assetstatus) && ($asset->assetstatus->deployable=='1'))
|
||||
@if (($asset->assigned_to != '') && ($asset->deleted_at==''))
|
||||
@can('checkin', \App\Models\Asset::class)
|
||||
<li role="menuitem">
|
||||
<a href="{{ route('hardware.checkin.create', $asset->id) }}">
|
||||
{{ trans('admin/hardware/general.checkin') }}
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@elseif (($asset->assigned_to == '') && ($asset->deleted_at==''))
|
||||
@can('checkout', \App\Models\Asset::class)
|
||||
<li role="menuitem">
|
||||
<a href="{{ route('hardware.checkout.create', $asset->id) }}">
|
||||
{{ trans('admin/hardware/general.checkout') }}
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@can('update', \App\Models\Asset::class)
|
||||
<li role="menuitem">
|
||||
<a href="{{ route('hardware.edit', $asset->id) }}">
|
||||
{{ trans('admin/hardware/general.edit') }}
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
|
||||
@can('create', \App\Models\Asset::class)
|
||||
<li role="menuitem">
|
||||
<a href="{{ route('clone/hardware', $asset->id) }}">
|
||||
{{ trans('admin/hardware/general.clone') }}
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
|
||||
@can('audit', \App\Models\Asset::class)
|
||||
<li role="menuitem">
|
||||
<a href="{{ route('asset.audit.create', $asset->id) }}">
|
||||
{{ trans('general.audit') }}
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
@endcan
|
||||
@stop
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
|
||||
|
@ -75,8 +14,7 @@
|
|||
@if (!$asset->model)
|
||||
<div class="col-md-12">
|
||||
<div class="callout callout-danger">
|
||||
<h2>{{ trans('admin/models/message.no_association') }}</h2>
|
||||
<p>{{ trans('admin/models/message.no_association_fix') }}</p>
|
||||
<p><strong>{{ trans('admin/models/message.no_association') }}</strong> {{ trans('admin/models/message.no_association_fix') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
@ -183,7 +121,7 @@
|
|||
</span>
|
||||
<span class="hidden-xs hidden-sm">
|
||||
{{ trans('general.additional_files') }}
|
||||
{!! ($asset->model->uploads->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($asset->model->uploads->count()).'</badge>' : '' !!}
|
||||
{!! ($asset->model) && ($asset->model->uploads->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($asset->model->uploads->count()).'</badge>' : '' !!}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
@ -626,7 +564,7 @@
|
|||
{{ $asset->warranty_months }}
|
||||
{{ trans('admin/hardware/form.months') }}
|
||||
|
||||
@if (($asset->model->manufacturer) && ($asset->model->manufacturer->warranty_lookup_url!=''))
|
||||
@if (($asset->model) && ($asset->model->manufacturer) && ($asset->model->manufacturer->warranty_lookup_url!=''))
|
||||
<a href="{{ $asset->present()->dynamicWarrantyUrl() }}" target="_blank">
|
||||
<i class="fa fa-external-link" aria-hidden="true"><span class="sr-only">{{ trans('admin/hardware/general.mfg_warranty_lookup', ['manufacturer' => $asset->model->manufacturer->name]) }}</span></i>
|
||||
</a>
|
||||
|
@ -885,17 +823,73 @@
|
|||
<div class="col-md-4">
|
||||
|
||||
@if (($asset->image) || (($asset->model) && ($asset->model->image!='')))
|
||||
|
||||
|
||||
<div class="text-center col-md-12" style="padding-bottom: 15px;">
|
||||
<a href="{{ ($asset->getImageUrl()) ? $asset->getImageUrl() : null }}" data-toggle="lightbox">
|
||||
<img src="{{ ($asset->getImageUrl()) ? $asset->getImageUrl() : null }}" class="assetimg img-responsive" alt="{{ $asset->getDisplayNameAttribute() }}">
|
||||
</a>
|
||||
</div>
|
||||
@else
|
||||
<!-- generic image goes here -->
|
||||
@endif
|
||||
|
||||
<!-- Start side button column -->
|
||||
|
||||
@if (($asset->assetstatus) && ($asset->assetstatus->deployable=='1'))
|
||||
@if (($asset->assigned_to != '') && ($asset->deleted_at==''))
|
||||
@can('checkin', \App\Models\Asset::class)
|
||||
<div class="col-md-12">
|
||||
<a href="{{ route('hardware.checkin.create', $asset->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print">
|
||||
{{ trans('admin/hardware/general.checkin') }}
|
||||
</a>
|
||||
</div>
|
||||
@endcan
|
||||
@elseif (($asset->assigned_to == '') && ($asset->deleted_at==''))
|
||||
@can('checkout', \App\Models\Asset::class)
|
||||
<div class="col-md-12" style="padding-top: 5px;">
|
||||
<a href="{{ route('hardware.checkout.create', $asset->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print">
|
||||
{{ trans('admin/hardware/general.checkout') }}
|
||||
</a>
|
||||
</div>
|
||||
@endcan
|
||||
@endif
|
||||
@endif
|
||||
|
||||
|
||||
@can('update', $asset)
|
||||
<div class="col-md-12" style="padding-top: 5px;">
|
||||
<a href="{{ route('hardware.edit', $asset->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print">
|
||||
{{ trans('admin/hardware/general.edit') }}
|
||||
</a>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@can('create', $asset)
|
||||
<div class="col-md-12" style="padding-top: 5px;">
|
||||
<a href="{{ route('clone/hardware', $asset->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print">
|
||||
{{ trans('admin/hardware/general.clone') }}
|
||||
</a>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@can('audit', \App\Models\Asset::class)
|
||||
<div class="col-md-12" style="padding-top: 5px;">
|
||||
<a href="{{ route('asset.audit.create', $asset->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print">
|
||||
{{ trans('general.audit') }}
|
||||
</a>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@can('delete', $asset)
|
||||
@if ($asset->deleted_at=='')
|
||||
<div class="col-md-12" style="padding-top: 30px; padding-bottom: 30px;">
|
||||
<button class="btn btn-block btn-danger delete-asset" data-toggle="modal" data-title="{{ trans('general.delete') }}" data-content="{{ trans('general.sure_to_delete', ['item' => $asset->asset_tag]) }}" data-target="#dataConfirmModal">{{ trans('general.delete') }} </button>
|
||||
<span class="sr-only">{{ trans('general.delete') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
@endcan
|
||||
|
||||
@if ($asset->deleted_at!='')
|
||||
<div class="text-center col-md-12" style="padding-bottom: 15px;">
|
||||
<div class="text-center col-md-12" style="padding-top: 30px; padding-bottom: 30px;">
|
||||
<form method="POST" action="{{ route('restore/hardware', ['assetId' => $asset->id]) }}">
|
||||
@csrf
|
||||
<button class="btn btn-danger col-md-12">{{ trans('general.restore') }}</button>
|
||||
|
@ -908,11 +902,13 @@
|
|||
@endif
|
||||
|
||||
@if (($asset->assignedTo) && ($asset->deleted_at==''))
|
||||
<h2>{{ trans('admin/hardware/form.checkedout_to') }}</h2>
|
||||
<div style="text-align: left">
|
||||
<h2>{{ trans('admin/hardware/form.checkedout_to') }}</h2>
|
||||
<p>
|
||||
@if($asset->checkedOutToUser()) <!-- Only users have avatars currently-->
|
||||
<img src="{{ $asset->assignedTo->present()->gravatar() }}" class="user-image-inline" alt="{{ $asset->assignedTo->present()->fullName() }}">
|
||||
@endif
|
||||
</p>
|
||||
{!! $asset->assignedTo->present()->glyph() . ' ' .$asset->assignedTo->present()->nameUrl() !!}
|
||||
</p>
|
||||
|
||||
|
@ -959,6 +955,7 @@
|
|||
</li>
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
</div> <!-- div.col-md-4 -->
|
||||
|
@ -1305,7 +1302,7 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@if ($asset->model->uploads->count() > 0)
|
||||
@if (($asset->model) && ($asset->model->uploads->count() > 0))
|
||||
<table
|
||||
class="table table-striped snipe-table"
|
||||
id="assetModelFileHistory"
|
||||
|
@ -1409,6 +1406,16 @@
|
|||
@stop
|
||||
|
||||
@section('moar_scripts')
|
||||
<script>
|
||||
|
||||
$('#dataConfirmModal').on('show.bs.modal', function (event) {
|
||||
var content = $(event.relatedTarget).data('content');
|
||||
var title = $(event.relatedTarget).data('title');
|
||||
$(this).find(".modal-body").text(content);
|
||||
$(this).find(".modal-header").text(title);
|
||||
});
|
||||
|
||||
</script>
|
||||
@include ('partials.bootstrap-table')
|
||||
|
||||
@stop
|
||||
|
|
Loading…
Reference in a new issue