@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @push('styles') @endpush @php $formatBerat = function ($value) { if ($value === null || $value === '') { return '-'; } $formatted = number_format((float) $value, 3, ',', '.'); return rtrim(rtrim($formatted, '0'), ','); }; @endphp @section('content') @include('layouts.navbars.auth.topnav', ['title' => $title ?? 'Penerimaan Barang'])
{{-- Header Info (readonly) --}}
Penerimaan: {{ $batch->batch_id }}
{{ $batch->vendor_name ?? 'Tanpa Vendor' }} Tipe: {{ $batch->in_type_name ?? '-' }} Rencana: {{ $batch->planned_date ? \Carbon\Carbon::parse($batch->planned_date)->format('d/m/Y') : '-' }} Mode: @if ($batch->receive_mode == 'GENERATE') GENERATE @else USE VENDOR ID @endif
@php $statusColors = [ 'PLANNED' => 'bg-info', 'IN_PROGRESS' => 'bg-warning', 'RECEIVED' => 'bg-success', 'CANCELLED' => 'bg-danger', ]; @endphp {{ $batch->status }}
{{-- Progress Section --}}
Progress Penerimaan
@foreach ($progress['plan_items'] as $item) @php $remaining = $item->qty_planned - $item->qty_received; $pct = $item->qty_planned > 0 ? round(($item->qty_received / $item->qty_planned) * 100) : 0; $progressColor = $pct >= 100 ? 'success' : ($pct > 0 ? 'info' : 'secondary'); @endphp
{{ $item->sku_code }} - {{ $item->nama_material }} @if ($item->color_name) ({{ $item->color_name }}) @endif {{ $item->qty_received }} / {{ $item->qty_planned }} bag @if ($remaining > 0) sisa {{ $remaining }} @elseif ($item->qty_received > $item->qty_planned) over +{{ abs($remaining) }} @else selesai @endif
@endforeach
Total Progress {{ $progress['total_received'] }} / {{ $progress['total_planned'] }} bag
{{-- Input Form --}}
Input Bag Baru
@if (!$gray_area) @else
@if ($batch->receive_mode === 'USE_VENDOR_ID')
@endif
@if ($batch->receive_mode === 'GENERATE')
@endif
{{-- Feedback Area --}} @endif
{{-- Received Bags List --}}
Bag yang Sudah Diterima
@foreach ($bags as $index => $bag) @php $isPending = $bag->status === 'PENDING'; $isWaitingApproval = !empty($bag->pending_approval); $isPlaced = !empty($bag->placed_at) || $bag->status !== 'PENDING'; $canDeleteBag = $isPending && !$isPlaced && !$isWaitingApproval; $rowClass = ''; $statusText = 'Belum Layouting'; $statusClass = 'bg-light text-secondary'; if ($isWaitingApproval) { $rowClass = 'bag-row-waiting'; $statusText = 'Menunggu Approval Layout'; $statusClass = 'badge-soft-warning'; } elseif ($isPlaced) { $rowClass = 'bag-row-placed'; $statusText = 'Sudah Layouting'; $statusClass = 'badge-soft-success'; } $layoutInfo = $bag->nama_layout ?? ($bag->current_layout_id ?? '-'); @endphp @endforeach
No {{ $batch->receive_mode === 'USE_VENDOR_ID' ? 'QR/Barcode Vendor' : 'Bag ID' }} Material Berat per Bag (kg) Status Waktu Aksi
{{ $index + 1 }} {{ $bag->barcode_value ?: '-' }} {{ $bag->sku_code }} - {{ $bag->nama_material }} {{ $formatBerat($bag->berat) }}
{{ $statusText }} @if ($isPlaced || $isWaitingApproval) {{ $layoutInfo }} @endif
{{ \Carbon\Carbon::parse($bag->created_at)->format('H:i:s') }} @if ($canDeleteBag) @else - @endif
@if ($bags->isEmpty())

Belum ada bag yang diterima. Mulai scan/input di form atas.

@endif
{{-- Action Buttons --}}
Simpan & Kembali
@csrf
{{-- Scanner Modal --}} {{-- QR Print Modal (for GENERATE mode) --}} @endsection @push('addjs') @include('js.trsinm-receive') @endpush @push('js') @endpush