mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -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()
|
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">
|
<div class="col-md-12">
|
||||||
@if(count($asset->components) > 0)
|
@if(count($asset->components) > 0)
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<th>{{ trans('general.name') }}</th>
|
||||||
|
<th>{{ trans('general.qty') }}</th>
|
||||||
|
<th>{{ trans('general.purchase_cost') }}</th>
|
||||||
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php $totalCost = 0; ?>
|
<?php $totalCost = 0; ?>
|
||||||
@foreach ($asset->components as $component)
|
@foreach ($asset->components as $component)
|
||||||
@if (is_null($component->deleted_at))
|
@if (is_null($component->deleted_at))
|
||||||
<tr>
|
<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>
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
Loading…
Reference in a new issue