@extends('layouts.app') @section('title', __('pharmacy::messages.stock.title')) @php use App\Support\Money\Money; $bands = [ 'expired' => __('pharmacy::messages.expiry_bands.expired'), 'critical' => __('pharmacy::messages.expiry_bands.critical'), 'warning' => __('pharmacy::messages.expiry_bands.warning'), 'watch' => __('pharmacy::messages.expiry_bands.watch'), ]; $states = [ 'in_stock' => __('pharmacy::messages.stock.state_in_stock'), 'empty' => __('pharmacy::messages.stock.state_empty'), 'written_off' => __('pharmacy::messages.batch_statuses.written_off'), ]; $hasFilters = collect($filters)->filter(fn ($v): bool => $v !== '')->isNotEmpty(); @endphp @section('content')

{{ __('pharmacy::messages.stock.title') }}

{{ __('pharmacy::messages.stock.subtitle') }}

@can('pharmacy.stock') {{ __('pharmacy::messages.stock.receive') }} @endcan
{{-- Outside the swapped region, so typing survives a filter change. --}}
@if ($hasFilters) {{ __('common.clear') }} @endif

{{ __('pharmacy::messages.stock.card_medicines') }}

{{ number_format($summary['medicines']) }}

{{ __('pharmacy::messages.stock.card_expiring') }}

{{ number_format($summary['expiring']) }}

{{-- Expired stock that is still marked active is money on a shelf that cannot be sold and a batch the allocator will never touch. It stays visible until somebody writes it off. --}}

{{ __('pharmacy::messages.stock.card_expired') }}

{{ number_format($summary['expired']) }}

@if ($batches->isEmpty())

{{ __('pharmacy::messages.stock.none') }}

{{ __('pharmacy::messages.stock.none_text') }}

@else
@if ($canAdjust) @endif @foreach ($batches as $batch) @php $medicine = $medicines[$batch->drug_id] ?? null; $band = $batch->expiryBand(); @endphp @if ($canAdjust) @endif @if ($canAdjust) @endif @endforeach
{{ __('pharmacy::messages.stock.medicine') }} {{ __('pharmacy::messages.stock.batch') }} {{ __('pharmacy::messages.stock.expiry') }} {{ __('pharmacy::messages.stock.available') }} {{ __('pharmacy::messages.stock.selling_price') }}{{ __('common.actions') }}
{{ $medicine?->label() ?? __('pharmacy::messages.stock.unknown_medicine') }} @if ($batch->supplier) {{ $batch->supplier }} @endif {{ $batch->batch_number }} @if ($batch->storage_location) {{ $batch->storage_location }} @endif {{ $batch->expiry_date->format('M Y') }} @if ($batch->status->value !== 'active') {{ $batch->status->label() }} @endif {{ number_format($batch->available_quantity) }} {{ __('pharmacy::messages.stock.of_purchased', ['count' => number_format($batch->purchased_quantity)]) }} @if ($batch->selling_price_minor !== null) {{ Money::fromMinor($batch->selling_price_minor, $batch->currency ?? $currency)->format() }} @else {{-- Unpriced, not free: nothing is billed for it. --}} {{ __('pharmacy::messages.stock.unpriced') }} @endif
{{-- The correction is a movement of its own, and it has to say why: an unexplained change cannot be told apart from a loss. --}}
@csrf
{{ $batches->links() }}
@endif
@endsection