@extends('layouts.admin') @section('content')
{{-- Header --}}

{{ __('Inventory Management') }}

{{ __('Track stock levels, stock-in orders, and movement history') }}

{{-- Tab Navigation --}}
{{ __('Stock Levels') }} {{ __('Stock-In Orders') }} {{ __('Movement History') }}
{{-- Tab: Stock Levels --}} @if($tab === 'stock')
@forelse($stocks as $stock) @empty @endforelse
{{ __('Product') }} {{ __('Warehouse') }} {{ __('Quantity') }} {{ __('Safety Stock') }} {{ __('Status') }}
@if($stock->product?->image_url) @else @endif
{{ $stock->product?->name ?? '-' }}
{{ $stock->warehouse?->name ?? '-' }} @if($stock->warehouse?->type === 'main') {{ __('Main') }} @endif {{ $stock->quantity }} {{ $stock->safety_stock }} @if($stock->safety_stock > 0 && $stock->quantity <= $stock->safety_stock) {{ __('Low Stock') }} @elseif($stock->quantity === 0) {{ __('Out of Stock') }} @else {{ __('Normal') }} @endif
{{ __('No stock data found') }}
{{ $stocks->links('vendor.pagination.luxury') }}
@endif {{-- Tab: Stock-In Orders --}} @if($tab === 'stock-in')
@forelse($orders as $order) @empty @endforelse
{{ __('Order No.') }} {{ __('Warehouse') }} {{ __('Status') }} {{ __('Created By') }} {{ __('Created At') }} {{ __('Actions') }}
{{ $order->order_no }} {{ $order->warehouse?->name }} @if($order->status === 'draft') {{ __('Draft') }} @else {{ __('Completed') }} @endif {{ $order->creator?->name ?? '-' }} {{ $order->created_at?->format('Y-m-d H:i') }} @if($order->status === 'draft')
@csrf @method('PATCH')
@else {{ $order->completed_at?->format('Y-m-d H:i') }} @endif
{{ __('No stock-in orders found') }}
{{ $orders->links('vendor.pagination.luxury') }}
@endif {{-- Tab: Movement History --}} @if($tab === 'movements')
@forelse($movements as $mv) @empty @endforelse
{{ __('Time') }} {{ __('Warehouse') }} {{ __('Product') }} {{ __('Type') }} {{ __('Qty Change') }} {{ __('Operator') }}
{{ $mv->created_at?->format('m-d H:i') }} {{ $mv->warehouse?->name }} {{ $mv->product?->name }} @php $typeColor = in_array($mv->type, ['in', 'transfer_in']) ? 'emerald' : (in_array($mv->type, ['out', 'transfer_out']) ? 'rose' : 'amber'); @endphp {{ __(\App\Models\Warehouse\StockMovement::TYPE_LABELS[$mv->type] ?? $mv->type) }} {{ in_array($mv->type, ['in', 'transfer_in']) ? '+' : '-' }}{{ $mv->quantity }} ({{ $mv->before_qty }}→{{ $mv->after_qty }}) {{ $mv->creator?->name ?? '-' }}
{{ __('No movement records found') }}
{{ $movements->links('vendor.pagination.luxury') }}
@endif {{-- Stock-In Modal --}}

{{ __('New Stock-In Order') }}

@csrf
@endsection