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) public function show($consumableId = null)
{ {
$consumable = Consumable::find($consumableId); $consumable = Consumable::withCount('users as users_consumables')->find($consumableId);
$this->authorize($consumable); $this->authorize($consumable);
if (isset($consumable->id)) { if (isset($consumable->id)) {
return view('consumables/view', compact('consumable')); return view('consumables/view', compact('consumable'));

View file

@ -3,7 +3,7 @@
{{-- Page title --}} {{-- Page title --}}
@section('title') @section('title')
{{ $consumable->name }} {{ $consumable->name }}
{{ trans('general.consumable') }} {{ trans('general.consumable') }} -
({{ trans('general.remaining_var', ['count' => $consumable->numRemaining()]) }}) ({{ trans('general.remaining_var', ['count' => $consumable->numRemaining()]) }})
@parent @parent
@endsection @endsection
@ -38,10 +38,10 @@
<li> <li>
<a href="#checkedout" data-toggle="tab"> <a href="#checkedout" data-toggle="tab">
<span class="hidden-lg hidden-md"> <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>
<span class="hidden-xs hidden-sm">{{ trans('general.users') }} <span class="hidden-xs hidden-sm">{{ trans('general.assigned') }}
{!! ($consumable->users->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($consumable->users->count()).'</badge>' : '' !!} {!! ($consumable->users_consumables > 0 ) ? '<badge class="badge badge-secondary">'.number_format($consumable->users_consumables).'</badge>' : '' !!}
</span> </span>
</a> </a>
</li> </li>
@ -190,6 +190,18 @@
</div> </div>
@endif @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 --> <!-- locationm -->
@if ($consumable->location) @if ($consumable->location)
<div class="row"> <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') }}"> <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> <span class="sr-only">{{ trans('general.copy_to_clipboard') }}</span>
</i> </i>
</div> </div>
</div> </div>
@endif @endif