mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Added qty to asset components - fixed #4876
This commit is contained in:
parent
fefd6d60f6
commit
543ea28b72
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue