Few more tweaks

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-07-20 16:21:11 +01:00
parent c08bd8f88b
commit 2bfee0c29a
2 changed files with 18 additions and 6 deletions

View file

@ -200,7 +200,7 @@ class ConsumablesController extends Controller
*/
public function show($consumableId = null)
{
$consumable = Consumable::find($consumableId);
$consumable = Consumable::withCount('users as users_consumables')->find($consumableId);
$this->authorize($consumable);
if (isset($consumable->id)) {
return view('consumables/view', compact('consumable'));

View file

@ -3,7 +3,7 @@
{{-- Page title --}}
@section('title')
{{ $consumable->name }}
{{ trans('general.consumable') }}
{{ trans('general.consumable') }} -
({{ trans('general.remaining_var', ['count' => $consumable->numRemaining()]) }})
@parent
@endsection
@ -38,10 +38,10 @@
<li>
<a href="#checkedout" data-toggle="tab">
<span class="hidden-lg hidden-md">
<i class="fas fa-info-circle fa-2x" aria-hidden="true"></i>
<i class="fas fa-users fa-2x" aria-hidden="true"></i>
</span>
<span class="hidden-xs hidden-sm">{{ trans('general.users') }}
{!! ($consumable->users->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($consumable->users->count()).'</badge>' : '' !!}
<span class="hidden-xs hidden-sm">{{ trans('general.assigned') }}
{!! ($consumable->users_consumables > 0 ) ? '<badge class="badge badge-secondary">'.number_format($consumable->users_consumables).'</badge>' : '' !!}
</span>
</a>
</li>
@ -190,6 +190,18 @@
</div>
@endif
<!-- min amt -->
@if ($consumable->min_amt)
<div class="row">
<div class="col-md-3">
{{ trans('general.min_amt') }}
</div>
<div class="col-md-9">
{{ $consumable->min_amt }}
</div>
</div>
@endif
<!-- locationm -->
@if ($consumable->location)
<div class="row">
@ -248,7 +260,7 @@
<i class="fa-regular fa-clipboard js-copy-link" data-clipboard-target=".js-copy" aria-hidden="true" data-tooltip="true" data-placement="top" title="{{ trans('general.copy_to_clipboard') }}">
<span class="sr-only">{{ trans('general.copy_to_clipboard') }}</span>
</i>
</div>
</div>
@endif