mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Do not try to show depreciation report if no depreciations are set up
This commit is contained in:
parent
facf1d42f7
commit
2f9fff7130
|
@ -7,6 +7,7 @@ use App\Models\Actionlog;
|
|||
use App\Models\Asset;
|
||||
use App\Models\AssetMaintenance;
|
||||
use App\Models\CustomField;
|
||||
use App\Models\Depreciation;
|
||||
use App\Models\License;
|
||||
use App\Models\Setting;
|
||||
use Carbon\Carbon;
|
||||
|
@ -221,11 +222,12 @@ class ReportsController extends Controller
|
|||
public function getDeprecationReport()
|
||||
{
|
||||
|
||||
$depreciations = Depreciation::get();
|
||||
// Grab all the assets
|
||||
$assets = Asset::with( 'assignedTo', 'assetstatus', 'defaultLoc', 'location', 'assetlog', 'company', 'model.category', 'model.depreciation')
|
||||
->orderBy('created_at', 'DESC')->get();
|
||||
|
||||
return view('reports/depreciation', compact('assets'));
|
||||
return view('reports/depreciation', compact('assets'))->with('depreciations',$depreciations);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-body">
|
||||
|
||||
|
||||
@if (($depreciations) && ($depreciations->count() > 0))
|
||||
<div class="table-responsive">
|
||||
<table
|
||||
class="table table-striped table-bordered table-compact"
|
||||
|
@ -134,6 +137,16 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</div> <!-- /.table-responsive-->
|
||||
@else
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-warning fade in">
|
||||
<i class="fa fa-warning faa-pulse animated"></i>
|
||||
<strong>Warning: </strong>
|
||||
You do not currently have any depreciations set up.
|
||||
Please set up at least one depreciation to view the depreciation report.
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div> <!-- /.box-body-->
|
||||
</div> <!--/box.box-default-->
|
||||
</div> <!-- /.col-md-12-->
|
||||
|
|
Loading…
Reference in a new issue