A free open source IT asset/license management system
Added qty to asset components - fixed #4876
snipe543ea28b7207
diff --git a/app/Models/Asset.php b/app/Models/Asset.phpindex 8d7a5bf75a..1c6ad8fcb8 100644--- a/app/Models/Asset.php+++ b/app/Models/Asset.php@@ -223,7 +223,7 @@ class Asset extends Depreciable*/public function components(){- return $this->belongsToMany('\App\Models\Component', 'components_assets', 'asset_id', 'component_id')->withPivot('id')->withTrashed();+ return $this->belongsToMany('\App\Models\Component', 'components_assets', 'asset_id', 'component_id')->withPivot('id', 'assigned_qty')->withTrashed();}/**diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.phpindex 9319bbe8c3..844a689772 100755--- a/resources/views/hardware/view.blade.php+++ b/resources/views/hardware/view.blade.php@@ -542,12 +542,22 @@<div class="col-md-12">@if(count($asset->components) > 0)<table class="table table-striped">+ <thead>+ <th>{{ trans('general.name') }}</th>+ <th>{{ trans('general.qty') }}</th>+ <th>{{ trans('general.purchase_cost') }}</th>+ </thead><tbody><?php $totalCost = 0; ?>@foreach ($asset->components as $component)@if (is_null($component->deleted_at))<tr>- <td><a href="{{ route('components.show', $component->id) }}">{{ $component->name }}</a></td>+ <td>+ <a href="{{ route('components.show', $component->id) }}">{{ $component->name }}</a>+ </td>+ <td>{{ $component->pivot->assigned_qty }}</td>+ <td>{{ $component->purchase_cost }}</td>+</tr>@endif@endforeach