Skip to content

Commit

Permalink
Add other items' purchase_cost columns to the same permission
Browse files Browse the repository at this point in the history
  • Loading branch information
inietov committed Dec 15, 2022
1 parent b142f8e commit d9a21cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config/permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@
[
'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,
],

Expand Down
24 changes: 16 additions & 8 deletions resources/views/account/view-assets.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,17 +536,21 @@ class="table table-striped snipe-table table-hover"
<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>
<tbody>
@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>
Expand Down Expand Up @@ -583,7 +587,9 @@ class="table table-striped snipe-table table-hover"
<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>
Expand All @@ -592,9 +598,11 @@ class="table table-striped snipe-table table-hover"
@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>
Expand Down

0 comments on commit d9a21cc

Please sign in to comment.