@extends('layouts.app')
@section('title',$stockTransfer->transfer_no)
@section('content')<div class="page-head"><div><div class="d-flex gap-2 align-items-center"><h1>{{ $stockTransfer->transfer_no }}</h1><span class="badge status-{{ $stockTransfer->status }}">{{ strtoupper(str_replace('_',' ',$stockTransfer->status)) }}</span></div><p>{{ $stockTransfer->fromWarehouse->code }} → {{ $stockTransfer->toWarehouse->code }} · {{ $stockTransfer->transfer_date->format('d M Y') }}</p></div><div class="d-flex gap-2">@if($stockTransfer->status==='draft')<form method="POST" action="{{ route('stock-transfers.approve',$stockTransfer) }}">@csrf<button class="btn btn-primary">Approve</button></form>@elseif(in_array($stockTransfer->status,['approved','in_transit']))<form method="POST" action="{{ route('stock-transfers.receive',$stockTransfer) }}">@csrf<button class="btn btn-primary">Receive stock</button></form>@endif</div></div><div class="card-erp"><div class="table-responsive"><table class="table table-dense"><thead><tr><th>#</th><th>Product</th><th>Unit</th><th class="text-end">Qty</th><th class="text-end">Base qty</th><th class="text-end">Unit cost</th><th class="text-end">Total cost</th></tr></thead><tbody>@foreach($stockTransfer->items as $x=>$i)<tr><td>{{ $x+1 }}</td><td>{{ $i->product?->name_en }}</td><td>{{ $i->unit?->code }}</td><td class="text-end">{{ number_format((float)$i->qty,4) }}</td><td class="text-end">{{ number_format((float)$i->base_qty,4) }}</td><td class="text-end">{{ number_format((float)$i->unit_cost,4) }}</td><td class="text-end">{{ number_format((float)$i->total_cost,2) }}</td></tr>@endforeach</tbody></table></div></div>@endsection
