A free open source IT asset/license management system
Make form-based restore button on asset view
snipe8bf09d9f89dc
diff --git a/resources/lang/en/general.php b/resources/lang/en/general.phpindex 539a01a13f..446957c9a5 100644--- a/resources/lang/en/general.php+++ b/resources/lang/en/general.php@@ -176,6 +176,7 @@'remove_company' => 'Remove Company Association','reports' => 'Reports','restored' => 'restored',+ 'restore' => 'Restore','requested' => 'Requested','request_canceled' => 'Request Canceled','save' => 'Save',diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.phpindex 7caa1ef57c..18b8d30ad1 100755--- a/resources/views/hardware/view.blade.php+++ b/resources/views/hardware/view.blade.php@@ -9,14 +9,17 @@{{-- 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 != '')+ @if (($asset->assigned_to != '') && ($asset->deleted_at==''))@can('checkin', \App\Models\Asset::class)<li role="menuitem"><a href="{{ route('checkin/hardware', $asset->id) }}">@@ -24,7 +27,7 @@</a></li>@endcan- @else+ @elseif (($asset->assigned_to == '') && ($asset->deleted_at==''))@can('checkout', \App\Models\Asset::class)<li role="menuitem"><a href="{{ route('checkout/hardware', $asset->id) }}">@@ -60,6 +63,7 @@@endcan</ul></div>+ @endif@endcan@stop@@ -80,10 +84,10 @@@if ($asset->deleted_at!='')<div class="col-md-12"><div class="alert alert-danger">- <i class="fa fa-exclamation-circle faa-pulse animated" aria-hidden="true"></i>+ <i class="fa fa-exclamation-triangle faa-pulse animated" aria-hidden="true"></i><strong>WARNING: </strong>This asset has been deleted.- You must <a href="{{ route('restore/hardware', $asset->id) }}">restore it</a> before you can assign it to someone.+ You must restore it before you can assign it to someone.</div></div>@endif@@ -96,76 +100,79 @@<!-- Custom Tabs --><div class="nav-tabs-custom"><ul class="nav nav-tabs">+<li class="active"><a href="#details" data-toggle="tab">- <span class="hidden-lg hidden-md">- <i class="fa fa-info-circle" aria-hidden="true"></i>- </span>- <span class="hidden-xs hidden-sm">- {{ trans('general.details') }}- </span>+ <span class="hidden-lg hidden-md">+ <i class="fa fa-info-circle fa-2x"x></i>+ </span>+ <span class="hidden-xs hidden-sm">{{ trans('admin/users/general.info') }}</span></a></li>+<li><a href="#software" data-toggle="tab">- <span class="hidden-lg hidden-md">- <i class="fa fa-floppy-o" aria-hidden="true"></i>- </span>- <span class="hidden-xs hidden-sm">- {{ trans('general.licenses') }}- </span>+ <span class="hidden-lg hidden-md">+ <i class="fa fa-save fa-2x" aria-hidden="true"></i>+ </span>+ <span class="hidden-xs hidden-sm">{{ trans('general.licenses') }}+ </span></a></li>+<li><a href="#components" data-toggle="tab">- <span class="hidden-lg hidden-md">- <i class="fa fa-hdd-o" aria-hidden="true"></i>- </span>- <span class="hidden-xs hidden-sm">- {{ trans('general.components') }}- </span>+ <span class="hidden-lg hidden-md">+ <i class="fa fa-hdd" aria-hidden="true"></i>+ </span>+ <span class="hidden-xs hidden-sm">{{ trans('general.components') }}+ </span></a></li>+<li><a href="#assets" data-toggle="tab">- <span class="hidden-lg hidden-md">- <i class="fa fa-barcode" aria-hidden="true"></i>- </span>- <span class="hidden-xs hidden-sm">- {{ trans('general.assets') }}- </span>+ <span class="hidden-lg hidden-md">+ <i class="fa fa-barcode fa-2x" aria-hidden="true"></i>+ </span>+ <span class="hidden-xs hidden-sm">{{ trans('general.assets') }}++ </span></a></li>++<li>- <a href="#maintenances" data-toggle="tab">- <span class="hidden-lg hidden-md">- <i class="fa fa-wrench" aria-hidden="true"></i>- </span>- <span class="hidden-xs hidden-sm">- {{ trans('general.maintenances') }}- </span>+ <a href="#history" data-toggle="tab">+ <span class="hidden-lg hidden-md">+ <i class="fa fa-history fa-2x" aria-hidden="true"></i>+ </span>+ <span class="hidden-xs hidden-sm">{{ trans('general.history') }}+ </span></a></li>+<li>- <a href="#history" data-toggle="tab">- <span class="hidden-lg hidden-md">- <i class="fa fa-history" aria-hidden="true"></i>- </span>- <span class="hidden-xs hidden-sm">- {{ trans('general.history') }}- </span>+ <a href="#maintenances" data-toggle="tab">+ <span class="hidden-lg hidden-md">+ <i class="fa fa-wrench fa-2x" aria-hidden="true"></i>+ </span>+ <span class="hidden-xs hidden-sm">{{ trans('general.maintenances') }}+ </span></a></li>+<li><a href="#files" data-toggle="tab">- <span class="hidden-lg hidden-md">- <i class="fa fa-files-o" aria-hidden="true"></i>- </span>- <span class="hidden-xs hidden-sm">- {{ trans('general.files') }}- </span>+ <span class="hidden-lg hidden-md">+ <i class="fa fa-file fa-2x" aria-hidden="true"></i>+ </span>+ <span class="hidden-xs hidden-sm">{{ trans('general.files') }}+ </span></a></li>++@can('update', \App\Models\Asset::class)<li class="pull-right"><a href="#" data-toggle="modal" data-target="#uploadFileModal">@@ -174,16 +181,31 @@</a></li>@endcan+</ul>+<div class="tab-content"><div class="tab-pane fade in active" id="details"><div class="row"><div class="col-md-8">-<!-- start striped rows --><div class="container row-striped">+ @if ($asset->deleted_at!='')+ <div class="row">+ <div class="col-md-2">+ <span class="text-danger"><strong>{{ trans('general.deleted') }}</strong></span>+ </div>+ <div class="col-md-6">+ {{ \App\Helpers\Helper::getFormattedDateObject($asset->deleted_at, 'date', false) }}++ </div>+ </div>+ @endif+++@if ($asset->assetstatus)<div class="row">@@ -196,7 +218,7 @@{{ $asset->assetstatus->name }}<label class="label label-default">{{ trans('general.deployed') }}</label>- <i class="fa fa-long-arrow-right" aria-hidden="true"></i>+ <i class="fa fa-long-arrow-alt-right" aria-hidden="true"></i>{!! $asset->assignedTo->present()->glyph() !!}{!! $asset->assignedTo->present()->nameUrl() !!}@else@@ -299,7 +321,7 @@@if (($asset->model) && ($asset->model->manufacturer->url))<li>- <i class="fa fa-globe" aria-hidden="true"></i>+ <i class="fa fa-globe-americas" aria-hidden="true"></i><a href="{{ $asset->model->manufacturer->url }}">{{ $asset->model->manufacturer->url }}</a>@@ -325,7 +347,8 @@@endif@if (($asset->model) && ($asset->model->manufacturer->support_email))- <li><i class="fa fa-envelope" aria-hidden="true"></i>+ <li>+ <i class="fa fa-envelope" aria-hidden="true"></i><a href="mailto:{{ $asset->model->manufacturer->support_email }}">{{ $asset->model->manufacturer->support_email }}</a>@@ -463,7 +486,28 @@</div></div>@endif+ @if (($asset->model) && ($asset->depreciation))+ <div class="row">+ <div class="col-md-2">+ <strong>+ {{ trans('admin/hardware/table.current_value') }}+ </strong>+ </div>+ <div class="col-md-6">+ <div class="col-md-6" style="margin-left:-15px;">+ @if (($asset->id) && ($asset->location))+ {{ $asset->location->currency }}+ @elseif (($asset->id) && ($asset->location))+ {{ $asset->location->currency }}+ @else+ {{ $snipeSettings->default_currency }}+ @endif+ {{ \App\Helpers\Helper::formatCurrencyOutput($asset->getDepreciatedValue() )}}+ </div>+ </div>+ </div>+ @endif@if ($asset->order_number)<div class="row"><div class="col-md-2">@@ -751,13 +795,22 @@@if (($asset->image) || (($asset->model) && ($asset->model->image!='')))- <div class="col-md-12 text-center" style="padding-bottom: 15px;">+ <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>@endif+ @if ($asset->deleted_at!='')+ <div class="text-center col-md-12" style="padding-bottom: 15px;">+ <form method="POST" action="{{ route('restore/hardware', ['assetId' => $asset->id]) }}">+ @csrf+ <button class="btn btn-danger col-md-12">{{ trans('general.restore') }}</button>+ </form>+ </div>+ @endif+@if ($snipeSettings->qr_code=='1')<img src="{{ config('app.url') }}/hardware/{{ $asset->id }}/qr_code" class="img-thumbnail pull-right" style="height: 100px; width: 100px; margin-right: 10px;" alt="QR code for {{ $asset->getDisplayNameAttribute() }}">@endif@@ -774,7 +827,7 @@<ul class="list-unstyled" style="line-height: 25px;">@if ((isset($asset->assignedTo->email)) && ($asset->assignedTo->email!=''))<li>- <i class="fa fa-envelope-o" aria-hidden="true"></i>+ <i class="fa fa-envelope" aria-hidden="true"></i><a href="mailto:{{ $asset->assignedTo->email }}">{{ $asset->assignedTo->email }}</a></li>@endif@@ -874,7 +927,7 @@<a href="{{ route('components.show', $component->id) }}">{{ $component->name }}</a></td><td>{{ $component->pivot->assigned_qty }}</td>- <td>{{ Helper::formatCurrencyOutput($component->purchase_cost) }} each</td>+ <td>{{ $component->purchase_cost }} each</td><?php $totalCost = $totalCost + ($component->purchase_cost *$component->pivot->assigned_qty) ?></tr>@endif@@ -885,7 +938,7 @@<tr><td colspan="2"></td>- <td>{{ Helper::formatCurrencyOutput($totalCost) }}</td>+ <td>{{ $totalCost }}</td></tr></tfoot></table>@@ -1114,7 +1167,7 @@<td>@can('update', \App\Models\Asset::class)- <a class="btn delete-asset btn-sm btn-danger btn-sm" href="{{ route('delete/assetfile', [$asset->id, $file->id]) }}" data-tooltip="true" data-title="Delete" data-content="{{ trans('general.delete_confirm', ['item' => $file->filename]) }}"><i class="fa fa-trash icon-white" aria-hidden="true"></i></a>+ <a class="btn delete-asset btn-sm btn-danger" href="{{ route('delete/assetfile', [$asset->id, $file->id]) }}" data-tooltip="true" data-title="Delete" data-content="{{ trans('general.delete_confirm', ['item' => $file->filename]) }}"><i class="fa fa-trash icon-white" aria-hidden="true"></i></a>@endcan</td></tr>