mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
c6cbf3712e
|
@ -68,9 +68,13 @@ class Depreciable extends SnipeModel
|
||||||
*/
|
*/
|
||||||
public function getLinearDepreciatedValue() // TODO - for testing it might be nice to have an optional $relative_to param here, defaulted to 'now'
|
public function getLinearDepreciatedValue() // TODO - for testing it might be nice to have an optional $relative_to param here, defaulted to 'now'
|
||||||
{
|
{
|
||||||
|
if ($this->purchase_date) {
|
||||||
$months_passed = $this->purchase_date->diff(now())->m;
|
$months_passed = $this->purchase_date->diff(now())->m;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if($months_passed >= $this->get_depreciation()->months){
|
if ($months_passed >= $this->get_depreciation()->months){
|
||||||
//if there is a floor use it
|
//if there is a floor use it
|
||||||
if($this->get_depreciation()->deprecation_min->isNotEmpty()) {
|
if($this->get_depreciation()->deprecation_min->isNotEmpty()) {
|
||||||
|
|
||||||
|
|
|
@ -372,6 +372,7 @@ return [
|
||||||
'bulk_checkin_delete_success' => 'Your selected users have been deleted and their items have been checked in.',
|
'bulk_checkin_delete_success' => 'Your selected users have been deleted and their items have been checked in.',
|
||||||
'bulk_checkin_success' => 'The items for the selected users have been checked in.',
|
'bulk_checkin_success' => 'The items for the selected users have been checked in.',
|
||||||
'set_to_null' => 'Delete values for this asset|Delete values for all :asset_count assets ',
|
'set_to_null' => 'Delete values for this asset|Delete values for all :asset_count assets ',
|
||||||
|
'na_no_purchase_date' => 'N/A - No purchase date provided',
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
|
@ -519,7 +519,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@if (($asset->model) && ($asset->depreciation))
|
@if (($asset->model) && ($asset->depreciation) && ($asset->purchase_date))
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<strong>
|
<strong>
|
||||||
|
@ -596,15 +596,20 @@
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<strong>
|
<strong>
|
||||||
{{ trans('admin/hardware/form.warranty_expires') }}
|
{{ trans('admin/hardware/form.warranty_expires') }}
|
||||||
|
@if ($asset->purchase_date)
|
||||||
{!! $asset->present()->warranty_expires() < date("Y-m-d") ? '<i class="fas fa-exclamation-triangle text-orange" aria-hidden="true"></i>' : '' !!}
|
{!! $asset->present()->warranty_expires() < date("Y-m-d") ? '<i class="fas fa-exclamation-triangle text-orange" aria-hidden="true"></i>' : '' !!}
|
||||||
|
@endif
|
||||||
|
|
||||||
</strong>
|
</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
@if ($asset->purchase_date)
|
||||||
{{ Helper::getFormattedDateObject($asset->present()->warranty_expires(), 'date', false) }}
|
{{ Helper::getFormattedDateObject($asset->present()->warranty_expires(), 'date', false) }}
|
||||||
-
|
-
|
||||||
{{ Carbon::parse($asset->present()->warranty_expires())->diffForHumans() }}
|
{{ Carbon::parse($asset->present()->warranty_expires())->diffForHumans() }}
|
||||||
|
@else
|
||||||
|
{{ trans('general.na_no_purchase_date') }}
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -630,9 +635,13 @@
|
||||||
</strong>
|
</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
@if ($asset->purchase_date)
|
||||||
{{ Helper::getFormattedDateObject($asset->depreciated_date()->format('Y-m-d'), 'date', false) }}
|
{{ Helper::getFormattedDateObject($asset->depreciated_date()->format('Y-m-d'), 'date', false) }}
|
||||||
-
|
-
|
||||||
{{ Carbon::parse($asset->depreciated_date())->diffForHumans() }}
|
{{ Carbon::parse($asset->depreciated_date())->diffForHumans() }}
|
||||||
|
@else
|
||||||
|
{{ trans('general.na_no_purchase_date') }}
|
||||||
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -659,10 +668,13 @@
|
||||||
</strong>
|
</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
@if ($asset->purchase_date)
|
||||||
{{ Helper::getFormattedDateObject($asset->present()->eol_date(), 'date', false) }}
|
{{ Helper::getFormattedDateObject($asset->present()->eol_date(), 'date', false) }}
|
||||||
-
|
-
|
||||||
{{ Carbon::parse($asset->present()->eol_date())->diffForHumans() }}
|
{{ Carbon::parse($asset->present()->eol_date())->diffForHumans() }}
|
||||||
|
@else
|
||||||
|
{{ trans('general.na_no_purchase_date') }}
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
@ -1186,10 +1198,14 @@
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@if (Storage::exists('private_uploads/assets/'.$file->filename))
|
||||||
{{ $file->filename }}
|
{{ $file->filename }}
|
||||||
|
@else
|
||||||
|
<del>{{ $file->filename }}</del>
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td data-value="{{ @Storage::size('private_uploads/assets/'.$file->filename) }}">
|
<td data-value="{{ (Storage::exists('private_uploads/assets/'.$file->filename) ? Storage::size('private_uploads/assets/'.$file->filename) : '') }}">
|
||||||
{{ @Helper::formatFilesizeUnits(Storage::size('private_uploads/assets/'.$file->filename)) }}
|
{{ @Helper::formatFilesizeUnits(Storage::exists('private_uploads/assets/'.$file->filename) ? Storage::size('private_uploads/assets/'.$file->filename) : '') }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($file->note)
|
@if ($file->note)
|
||||||
|
@ -1197,7 +1213,7 @@
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($file->filename)
|
@if (($file->filename) && (Storage::exists('private_uploads/assets/'.$file->filename)))
|
||||||
<a href="{{ route('show/assetfile', [$asset->id, $file->id]) }}" class="btn btn-default">
|
<a href="{{ route('show/assetfile', [$asset->id, $file->id]) }}" class="btn btn-default">
|
||||||
<i class="fas fa-download" aria-hidden="true"></i>
|
<i class="fas fa-download" aria-hidden="true"></i>
|
||||||
</a>
|
</a>
|
||||||
|
@ -1279,10 +1295,14 @@
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@if (Storage::exists('private_uploads/assetmodels/'.$file->filename))
|
||||||
{{ $file->filename }}
|
{{ $file->filename }}
|
||||||
|
@else
|
||||||
|
<del>{{ $file->filename }}</del>
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td data-value="{{ Storage::size('private_uploads/assetmodels/'.$file->filename) }}">
|
<td data-value="{{ (Storage::exists('private_uploads/assetmodels/'.$file->filename) ? Storage::size('private_uploads/assetmodels/'.$file->filename) : '') }}">
|
||||||
{{ Helper::formatFilesizeUnits(Storage::size('private_uploads/assetmodels/'.$file->filename)) }}
|
{{ Helper::formatFilesizeUnits(@Storage::size('private_uploads/assetmodels/'.$file->filename)) }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($file->note)
|
@if ($file->note)
|
||||||
|
@ -1290,7 +1310,7 @@
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($file->filename)
|
@if (($file->filename) && (Storage::exists('private_uploads/assetmodels/'.$file->filename)))
|
||||||
<a href="{{ route('show/modelfile', [$asset->model->id, $file->id]) }}" class="btn btn-default">
|
<a href="{{ route('show/modelfile', [$asset->model->id, $file->id]) }}" class="btn btn-default">
|
||||||
<i class="fas fa-download" aria-hidden="true"></i>
|
<i class="fas fa-download" aria-hidden="true"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in a new issue