@extends('layouts.admin') @section('content') @php $statusLabels = [ 'awaiting_pickup' => __('Awaiting Pickup'), 'completed' => __('Picked Up'), 'failed' => __('Voided'), 'pending' => __('Pending'), 'abandoned' => __('Abandoned'), ]; $statusColors = [ 'awaiting_pickup' => 'bg-amber-100 text-amber-700 dark:bg-amber-500/10 dark:text-amber-400', 'completed' => 'bg-emerald-100 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400', 'failed' => 'bg-rose-100 text-rose-700 dark:bg-rose-500/10 dark:text-rose-400', ]; @endphp

{{ __('menu.sales.pharmacy-pickup') }}

{{ __('Issue a pharmacy pickup order, print the QR ticket, patient scans at the machine to dispense.') }}
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @if($errors->any())
@endif {{-- 建立領藥單 --}}

{{ __('Create Pharmacy Pickup Order') }}

@if($machines->isEmpty())

{{ __('No machines enabled for pharmacy pickup. Enable it under Machine System Settings (Pickup Sheet mode → Pharmacy Pickup switch).') }}

@else {{-- 選機台(變更即重新載入該機台可領藥品) --}}
@if($selectedMachine)
@csrf
@if($products->isEmpty())

{{ __('This machine currently has no medicine in stock.') }}

@else
@foreach($products as $p) @endforeach
{{ __('Medicine') }} {{ __('Spec') }} {{ __('Available') }}
{{ __('(deducted by issued pickup orders)') }}
{{ __('Quantity') }}
{{ $p->name }} {{ $p->spec ?: '-' }} {{ $p->available }} @if(($p->reserved ?? 0) > 0) ({{ __('physical') }} {{ $p->physical }} − {{ __('reserved') }} {{ $p->reserved }}) @endif
@endif
@endif @endif
{{-- 領藥單列表 --}}

{{ __('Pharmacy Pickup Orders') }}

@forelse($orders as $order) @empty @endforelse
{{ __('Order No.') }} {{ __('Pricing Slip No.') }} {{ __('Machine') }} {{ __('Items') }} {{ __('Pickup Code') }} {{ __('Status') }} {{ __('Created') }} {{ __('Actions') }}
{{ $order->order_no }} {{ $order->pricing_slip_no ?: '-' }} {{ $order->machine?->name ?? '-' }} @foreach($order->items as $it)
{{ $it->product_name }} × {{ $it->quantity }}
@endforeach
{{ $order->pickupCode?->code ?? '-' }} {{ $statusLabels[$order->status] ?? $order->status }}
{{ $order->created_at?->format('Y-m-d H:i') }}
{{ $order->creator?->name }}
@if($order->status !== 'failed' && $order->pickupCode) {{ __('Print') }} @endif @if($order->status === 'awaiting_pickup')
@csrf
@endif @if($order->status === 'failed' && !($order->pickupCode)) - @endif
{{ __('No pharmacy pickup orders yet.') }}
{{ $orders->links() }}
@endsection