{{-- Header --}}

Approval Produk

Tinjau pengajuan produk baru dari supplier.

{{-- Tab Filter --}}
{{-- Table --}}
@forelse($products as $product) @empty @endforelse
Produk Supplier Harga Pengajuan Stok Tanggal Aksi
@if($product->image) {{ $product->name }} @else
📦
@endif
{{ $product->name }}
@if($product->approvalStatus === 'PENDING' && $product->created_at->diffInHours() < 24) @endif

{{ $product->sku }}

@if($product->supplier)
{{ strtoupper(substr($product->supplier->businessName ?? 'S', 0, 1)) }}

{{ $product->supplier->businessName }}

{{ $product->supplier->supplierType ?? 'Supplier' }}

@else - @endif
@if($status === 'PENDING')
Harga Ajuan
Rp {{ number_format($product->buyPrice ?? 0, 0, ',', '.') }}
@else Rp {{ number_format($product->sellPrice ?? 0, 0, ',', '.') }} @endif
{{ $product->stock }} Pcs @if($status === 'APPROVED' && $product->approvedAt)
Disetujui {{ $product->approvedAt->diffForHumans() }}
@elseif($status === 'REJECTED' && $product->updated_at)
Ditolak {{ $product->updated_at->diffForHumans() }}
@else
Diajukan {{ $product->created_at->diffForHumans() }}
@endif
@if($status === 'PENDING') @elseif($status === 'APPROVED') Disetujui @else Ditolak @endif

Tidak ada produk dengan status ini.

@if($products->hasPages())
{{ $products->links() }}
@endif
{{-- Detail Modal --}} @if($showModal && $selectedProduct)
{{-- Header --}}

Detail Pengajuan #{{ $selectedProduct->id }}

{{-- Left: Product Info --}}
@if($selectedProduct->image) {{ $selectedProduct->name }} @else
📦
@endif

{{ $selectedProduct->name }}

{{ $selectedProduct->approvalStatus }}
{{ $selectedProduct->sku }} Stok: {{ $selectedProduct->stock }} Pcs

{{ $selectedProduct->description ?? 'Tidak ada deskripsi.' }}

{{-- Supplier Info --}} @if($selectedProduct->supplier)
{{ strtoupper(substr($selectedProduct->supplier->businessName ?? 'S', 0, 1)) }}
{{ $selectedProduct->supplier->businessName }}

{{ $selectedProduct->supplier->supplierType ?? 'Supplier' }}

@endif
{{-- Right: Price Analysis & Actions --}} {{-- Right: Analysis & Decision --}}

Analisis & Keputusan

@if($status === 'PENDING') {{-- 1. Context: Supplier Data (Immutable) --}}

Harga Beli (Supplier)

Rp {{ number_format($selectedProduct->buyPrice ?? 0, 0, ',', '.') }} / unit

{{-- 2. Decision: Pricing Strategy --}}
{{-- Input Harga Jual --}}
Rp
{{-- Simple Profit/Loss Text --}}
Estimasi Laba per Unit: -Rp
{{-- Calculator Tools --}}
{{-- Markup --}}
%

Margin Markup

{{-- Margin --}}
%

Margin Laba

{{-- 3. Actions --}}
{{-- Rejection Note (Toggled) --}}
@error('adminNote') {{ $message }} @enderror
@else {{-- Read-Only View for Approved/Rejected --}}
@if($status === 'APPROVED')

Produk Disetujui

Produk ini sudah aktif di katalog.

Harga Beli

Rp {{ number_format($selectedProduct->buyPrice ?? 0, 0, ',', '.') }}

Harga Jual

Rp {{ number_format($sellPrice ?? 0, 0, ',', '.') }}

@else

Produk Ditolak

Pengajuan ini telah ditolak.

@if($selectedProduct->rejectionReason)

Alasan:

"{{ $selectedProduct->rejectionReason }}"

@endif @endif
@endif
@endif