@extends('layouts.admin') @section('title','Transfers') @section('content') @php $columns = [ 'transfer' => 'Transfer', 'route' => 'Route', 'units' => 'Units', 'progress' => 'Progress', 'status' => 'Status', 'created' => 'Created', 'actions' => 'Actions', ]; $label = fn (string $v) => ucwords(str_replace(['_', '-'], ' ', $v)); $statusTone = fn (string $s) => match ($s) { 'draft' => 'muted', 'in_transit' => 'info', 'partial' => 'warning', 'received' => 'success', 'canceled' => 'danger', default => 'muted', }; $activeChips = collect([ 'status' => request('status'), 'from_location_id' => request('from_location_id') ? ($locations->firstWhere('id', (int) request('from_location_id'))?->code) : null, 'to_location_id' => request('to_location_id') ? ($locations->firstWhere('id', (int) request('to_location_id'))?->code) : null, 'sort' => request('sort') && request('sort') !== 'newest' ? request('sort') : null, ])->filter(); @endphp Inventory Export CSV New transfer Open pipeline {{ number_format($stats['draft'] + $stats['in_transit'] + $stats['partial']) }} {{ number_format($stats['total']) }} all time Draft {{ number_format($stats['draft']) }} Ready to pick & ship In transit {{ number_format($stats['in_transit']) }} {{ number_format($stats['units_in_flight']) }} units incoming Partial {{ number_format($stats['partial']) }} Split receipts Received {{ number_format($stats['received']) }} Closed into available @foreach([ ['label' => 'All', 'params' => []], ['label' => 'Open', 'params' => ['status' => 'open']], ['label' => 'Draft', 'params' => ['status' => 'draft']], ['label' => 'In transit', 'params' => ['status' => 'in_transit']], ['label' => 'Partial', 'params' => ['status' => 'partial']], ['label' => 'Received', 'params' => ['status' => 'received']], ['label' => 'Canceled', 'params' => ['status' => 'canceled']], ] as $chip) @php $isActive = empty($chip['params']) ? ! request('status') : request('status') === ($chip['params']['status'] ?? null); @endphp {{ $chip['label'] }} @endforeach @if($activeChips->isNotEmpty()) Active @foreach($activeChips as $key => $value) {{ $label($key) }}: {{ $label((string) $value) }} @endforeach Clear all @endif Status Any @foreach(['open','draft','in_transit','partial','received','canceled'] as $status) {{ $label($status) }} @endforeach From Any origin @foreach($locations as $location) id)>{{ $location->name }} @endforeach To Any destination @foreach($locations as $location) id)>{{ $location->name }} @endforeach Sort Newest Oldest Number Clear Cancel selected draft transfers. Cancel drafts Transfer Route Units Progress Status Created @forelse($transfers as $transfer) @php $requested = (int) $transfer->units_requested; $received = (int) $transfer->units_received; $pct = $requested > 0 ? (int) round(($received / $requested) * 100) : 0; @endphp {{ $transfer->number }} {{ $transfer->lines_count }} line{{ $transfer->lines_count === 1 ? '' : 's' }} · {{ $transfer->shipments_count }} shipment{{ $transfer->shipments_count === 1 ? '' : 's' }} {{ $transfer->fromLocation?->code }} → {{ $transfer->toLocation?->code }} {{ $transfer->fromLocation?->name }} to {{ $transfer->toLocation?->name }} {{ number_format($received) }} / {{ number_format($requested) }} received {{ number_format((int) $transfer->units_shipped) }} shipped {{ $pct }}% {{ $label($transfer->status) }} {{ $transfer->created_at?->diffForHumans() }} {{ $transfer->createdBy?->name ?? 'System' }} Open @empty No transfers match these filters. @endforelse @if(request('q')) @endif @csrf {{ $transfers->links() }} @endsection