Skip to content

A free open source IT asset/license management system

Add other items' purchase_cost columns to the same permission

Ivan Nieto Vivancod9a21cce00a0
diff --git a/config/permissions.php b/config/permissions.php
index 366590e8c7..0b65a4e26b 100644
--- a/config/permissions.php
+++ b/config/permissions.php
@@ -648,7 +648,7 @@ return [
[
'permission' => 'self.view_purchase_cost',
'label' => 'View Purchase-Cost Column',
- 'note' => 'This user can see the purchase cost column of assets assigned to them.',
+ 'note' => 'This user can see the purchase cost column of items assigned to them.',
'display' => true,
],
diff --git a/resources/views/account/view-assets.blade.php b/resources/views/account/view-assets.blade.php
index e333a72625..b77bddcf0d 100755
--- a/resources/views/account/view-assets.blade.php
+++ b/resources/views/account/view-assets.blade.php
@@ -536,7 +536,9 @@
<thead>
<tr>
<th class="col-md-5">{{ trans('general.name') }}</th>
- <th class="col-md-6" data-footer-formatter="sumFormatter" data-fieldname="purchase_cost">{{ trans('general.purchase_cost') }}</th>
+ @can('self.view_purchase_cost')
+ <th class="col-md-6" data-footer-formatter="sumFormatter" data-fieldname="purchase_cost">{{ trans('general.purchase_cost') }}</th>
+ @endcan
<th class="col-md-1 hidden-print">{{ trans('general.action') }}</th>
</tr>
</thead>
@@ -544,9 +546,11 @@
@foreach ($user->accessories as $accessory)
<tr>
<td>{{ $accessory->name }}</td>
- <td>
- {!! Helper::formatCurrencyOutput($accessory->purchase_cost) !!}
- </td>
+ @can('self.view_purchase_cost')
+ <td>
+ {!! Helper::formatCurrencyOutput($accessory->purchase_cost) !!}
+ </td>
+ @endcan
<td class="hidden-print">
@can('checkin', $accessory)
<a href="{{ route('accessories.checkin.show', array('accessoryID'=> $accessory->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm hidden-print">{{ trans('general.checkin') }}</a>
@@ -583,7 +587,9 @@
<thead>
<tr>
<th class="col-md-3">{{ trans('general.name') }}</th>
- <th class="col-md-2" data-footer-formatter="sumFormatter" data-fieldname="purchase_cost">{{ trans('general.purchase_cost') }}</th>
+ @can('self.view_purchase_cost')
+ <th class="col-md-2" data-footer-formatter="sumFormatter" data-fieldname="purchase_cost">{{ trans('general.purchase_cost') }}</th>
+ @endcan
<th class="col-md-2">{{ trans('general.date') }}</th>
<th class="col-md-5">{{ trans('general.notes') }}</th>
</tr>
@@ -592,9 +598,11 @@
@foreach ($user->consumables as $consumable)
<tr>
<td>{{ $consumable->name }}</td>
- <td>
- {!! Helper::formatCurrencyOutput($consumable->purchase_cost) !!}
- </td>
+ @can('self.view_purchase_cost')
+ <td>
+ {!! Helper::formatCurrencyOutput($consumable->purchase_cost) !!}
+ </td>
+ @endcan
<td>{{ Helper::getFormattedDateObject($consumable->pivot->created_at, 'datetime', false) }}</td>
<td>{{ $consumable->pivot->note }}</td>
</tr>