{{-- Header --}}

Clearing & Matching Produk Retail

Petakan nama barang dari CSV ke data Produk & Supplier di database untuk laporan RAT yang akurat.

@if($csvExists && $unmappedCount > 0) @endif
{{-- Stats Cards --}}

Total Produk CSV

{{ number_format($totalCsvProducts) }} Barang

Terpetakan (Mapped)

{{ number_format($mappedCount) }} Barang

Belum Terpetakan

{{ number_format($unmappedCount) }} Barang

{{-- Main Content Card --}}
{{-- Tabs --}}
{{-- Flash messages --}} @if(session()->has('message'))
{{ session('message') }}
@endif {{-- TAB 1: UPLOAD CSV --}} @if($activeTab === 'upload')
@if($csvFile)

{{ $csvFile->getClientOriginalName() }}

@endif
@if($csvExists)

File Ter-import Saat Ini

Ukuran: {{ number_format($fileStats['size'] / 1024, 2) }} KB | Diperbarui: {{ date('d M Y H:i:s', $fileStats['updated_at']) }}

@endif
@endif {{-- TAB 2: PEMETAAN PRODUK --}} @if($activeTab === 'mapping')
{{-- Search Mapping & Filters --}}
{{-- Search --}}
{{-- Filter Status --}}
{{-- Filter Category --}}
{{-- Sort By --}}
@if(count($mappingList) > 0)
@foreach($mappingList as $item) @endforeach
Nama Barang di CSV (Raw) Produk Database (Real) Supplier & SKU Aksi
{{ $item['raw_name'] }}
@if(!empty($item['prices']['beli'])) Beli: Rp {{ implode(', Rp ', array_map(fn($p) => number_format($p, 0, ',', '.'), $item['prices']['beli'])) }} @endif @if(!empty($item['prices']['jual'])) Jual: Rp {{ implode(', Rp ', array_map(fn($p) => number_format($p, 0, ',', '.'), $item['prices']['jual'])) }} @endif
@if($item['mapping'] && $item['mapping']->product)
{{ $item['mapping']->product->name }}
@else {{-- Product Search Autocomplete selector --}} @endif
@if($item['mapping'] && $item['mapping']->product)
{{ $item['category_name'] }}

{{ $item['supplier_name'] }}

SKU: {{ $item['mapping']->product->sku ?? '-' }}

@else Belum terhubung @endif
@if($item['mapping'] && $item['mapping']->product) @else Menunggu input @endif
@else

Tidak ada produk matching

Pastikan CSV sudah di-upload dan filter pencarian tidak salah.

@endif
@endif {{-- TAB 3: PREVIEW DATA CLEARING --}} @if($activeTab === 'preview')
@if(count($previewRows) > 0)
@foreach($previewRows as $row) @endforeach
Tanggal Nama CSV Produk Database Supplier Qty Harga Beli Total Beli Harga Jual Total Jual Keuntungan
{{ $row['tanggal'] }} {{ $row['raw_name'] }} @if($row['product']) {{ $row['product']->name }} @else ⚠️ Belum Dipetakan @endif @if($row['product']) {{ $row['product']->supplier?->businessName ?? 'TOKO (Koperasi)' }} @else - @endif {{ number_format($row['quantity']) }} {{ $row['satuan'] }} Rp {{ number_format($row['harga_beli_satuan']) }} Rp {{ number_format($row['total_harga_beli']) }} Rp {{ number_format($row['harga_jual_satuan']) }} Rp {{ number_format($row['total_harga_jual']) }} Rp {{ number_format($row['total_keuntungan']) }}
@else

Belum ada preview data

Pastikan CSV sudah di-upload dengan benar.

@endif
@endif