<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />

    <style>
        .custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
        .custom-scrollbar::-webkit-scrollbar-track { background: #f1f5f9; }
        .custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
        .log-row { transition: all 0.2s ease; }
        .log-row:hover { background-color: #fef9f0; }
        .glass-card { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 1); }
        
        /* Custom Select Appearance */
        .custom-select {
            background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%238c6a4a' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
            background-position: right 0.5rem center;
            background-repeat: no-repeat;
            background-size: 1.5em 1.5em;
            padding-right: 2.5rem;
        }
    </style>

    <div class="min-h-screen bg-[#FAF7F2] pb-20">
        <div class="max-w-7xl mx-auto p-4 sm:p-6 lg:p-12">
            
            
            <div class="flex flex-col lg:flex-row lg:items-center justify-between gap-8 mb-12">
                <div class="space-y-2">
                    <div class="flex items-center gap-4">
                        <a href="<?php echo e(route('products.index')); ?>" class="w-10 h-10 flex items-center justify-center bg-white border border-[#e0d3c2] text-[#8c6a4a] rounded-xl hover:text-[#d97706] hover:border-[#f59e0b] transition-all shadow-sm">
                            <i class="fas fa-arrow-left text-xs"></i>
                        </a>
                        <h1 class="text-3xl sm:text-4xl font-extrabold text-[#2c1a0e] tracking-tight">
                            Riwayat <span class="text-[#f59e0b]">Stok</span>
                        </h1>
                    </div>
                    <p class="text-[#8c6a4a] font-medium ml-14">Laporan mutasi barang masuk dan keluar.</p>
                </div>

                <div class="flex items-center">
                    <a href="<?php echo e(route('stock.pdf', request()->query())); ?>" target="_blank" class="px-6 py-3.5 bg-gradient-to-r from-[#f59e0b] to-[#d97706] text-white rounded-xl font-bold text-sm hover:from-[#d97706] hover:to-[#b45309] transition-all shadow-md shadow-[#f59e0b]/20 flex items-center gap-2">
                        <i class="fas fa-file-pdf"></i>
                        <span>Cetak Laporan PDF</span>
                    </a>
                </div>
            </div>

            
            <form action="<?php echo e(route('stock-logs.index')); ?>" method="GET" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4 mb-8">
                
                
                <div class="relative group">
                    <label class="block text-[10px] font-black uppercase text-[#8c6a4a] mb-1.5 ml-1 tracking-wider">Cari Produk</label>
                    <div class="relative">
                        <input type="text" name="search" value="<?php echo e(request('search')); ?>" placeholder="Nama barang..." 
                            class="pl-10 pr-4 py-3 rounded-xl border-none bg-white shadow-sm ring-1 ring-[#e0d3c2] focus:ring-2 focus:ring-[#f59e0b]/50 transition-all w-full text-sm font-bold text-[#2c1a0e]">
                        <i class="fas fa-search absolute left-4 top-1/2 -translate-y-1/2 text-[#c9b59b] group-focus-within:text-[#f59e0b] transition-colors"></i>
                    </div>
                </div>

                
                <div>
                    <label class="block text-[10px] font-black uppercase text-[#8c6a4a] mb-1.5 ml-1 tracking-wider">Kategori</label>
                    <select name="category_id" onchange="this.form.submit()" 
                        class="custom-select px-4 py-3 rounded-xl border-none bg-white shadow-sm ring-1 ring-[#e0d3c2] focus:ring-2 focus:ring-[#f59e0b]/50 transition-all w-full text-sm font-bold text-[#2c1a0e] appearance-none cursor-pointer">
                        <option value="">Semua Kategori</option>
                        <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($category->id); ?>" <?php echo e(request('category_id') == $category->id ? 'selected' : ''); ?>>
                                <?php echo e($category->name); ?>

                            </option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>

                
                <div>
                    <label class="block text-[10px] font-black uppercase text-[#8c6a4a] mb-1.5 ml-1 tracking-wider">Dari Tanggal</label>
                    <input type="date" name="start_date" value="<?php echo e(request('start_date')); ?>" 
                        class="px-4 py-3 rounded-xl border-none bg-white shadow-sm ring-1 ring-[#e0d3c2] focus:ring-2 focus:ring-[#f59e0b]/50 transition-all w-full text-sm font-bold text-[#2c1a0e]">
                </div>

                
                <div>
                    <label class="block text-[10px] font-black uppercase text-[#8c6a4a] mb-1.5 ml-1 tracking-wider">Sampai Tanggal</label>
                    <input type="date" name="end_date" value="<?php echo e(request('end_date')); ?>" 
                        class="px-4 py-3 rounded-xl border-none bg-white shadow-sm ring-1 ring-[#e0d3c2] focus:ring-2 focus:ring-[#f59e0b]/50 transition-all w-full text-sm font-bold text-[#2c1a0e]">
                </div>

                
                <div class="flex items-end gap-2">
                    <button type="submit" class="flex-1 bg-[#2c1a0e] text-white py-3 rounded-xl font-bold text-sm hover:bg-[#4a2d18] transition-all shadow-md flex items-center justify-center gap-2">
                        <i class="fas fa-filter text-xs"></i>
                        Filter
                    </button>
                    <?php if(request()->anyFilled(['search', 'category_id', 'start_date', 'end_date'])): ?>
                        <a href="<?php echo e(route('stock-logs.index')); ?>" class="px-4 py-3 bg-white text-[#8c6a4a] rounded-xl hover:bg-[#fef3c7] hover:text-[#d97706] transition-all shadow-sm border border-[#e0d3c2]" title="Reset Filter">
                            <i class="fas fa-sync-alt"></i>
                        </a>
                    <?php endif; ?>
                </div>
            </form>

            
            <div class="glass-card rounded-2xl shadow-xl shadow-slate-200/50 overflow-hidden border border-[#e0d3c2]">
                <div class="overflow-x-auto custom-scrollbar">
                    <table class="w-full text-left border-collapse">
                        <thead>
                            <tr class="bg-[#fef9f0] border-b border-[#e0d3c2]">
                                <th class="px-6 py-5 text-[10px] font-black uppercase text-[#8c6a4a] tracking-wider">Waktu & Admin</th>
                                <th class="px-6 py-5 text-[10px] font-black uppercase text-[#8c6a4a] tracking-wider">Produk</th>
                                <th class="px-4 py-5 text-[10px] font-black uppercase text-[#8c6a4a] tracking-wider text-center bg-[#fef3c7]/20">Stok Awal</th>
                                <th class="px-4 py-5 text-[10px] font-black uppercase text-[#8c6a4a] tracking-wider text-center">Perubahan</th>
                                <th class="px-4 py-5 text-[10px] font-black uppercase text-[#8c6a4a] tracking-wider text-center bg-[#fef3c7]/20">Stok Akhir</th>
                                <th class="px-6 py-5 text-[10px] font-black uppercase text-[#8c6a4a] tracking-wider">Catatan</th>
                            </tr>
                        </thead>
                        <tbody class="divide-y divide-[#f0e7dc]">
                            <?php $__empty_1 = true; $__currentLoopData = $logs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $log): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <?php
                                    $stokSesudah = $log->stock_after;
                                    $stokSebelum = ($log->type === 'masuk') 
                                        ? ($stokSesudah - $log->quantity) 
                                        : ($stokSesudah + $log->quantity);
                                ?>
                                <tr class="log-row group">
                                    <td class="px-6 py-5">
                                        <div class="flex flex-col">
                                            <span class="font-bold text-[#2c1a0e] text-sm"><?php echo e($log->created_at->translatedFormat('d M Y')); ?></span>
                                            <span class="text-[10px] text-[#8c6a4a] font-bold uppercase tracking-tighter">
                                                <?php echo e($log->created_at->format('H:i')); ?> • <span class="text-[#d97706]"><?php echo e($log->user?->name ?? 'Sistem'); ?></span>
                                            </span>
                                        </div>
                                    </td>
                                    <td class="px-6 py-5">
                                        <div class="flex flex-col">
                                            <span class="font-bold text-[#2c1a0e] text-sm group-hover:text-[#d97706] transition-colors leading-tight">
                                                <?php echo e($log->variant->product->name ?? 'Item N/A'); ?>

                                            </span>
                                            <span class="text-[9px] font-black text-[#8c6a4a] uppercase tracking-wider mt-0.5">
                                                <?php echo e($log->variant->product->category->name ?? 'Tanpa Kategori'); ?> • <?php echo e($log->variant->color ?? '-'); ?>

                                            </span>
                                        </div>
                                    </td>
                                    <td class="px-4 py-5 text-center bg-[#fef3c7]/10">
                                        <span class="text-sm font-bold text-[#8c6a4a] italic"><?php echo e($stokSebelum); ?></span>
                                    </td>
                                    <td class="px-4 py-5 text-center">
                                        <?php if($log->type === 'masuk'): ?>
                                            <div class="inline-flex items-center gap-1.5 px-3 py-1 bg-emerald-50 text-emerald-600 rounded-lg border border-emerald-100">
                                                <i class="fas fa-plus-circle text-[10px]"></i>
                                                <span class="font-black text-sm"><?php echo e($log->quantity); ?></span>
                                            </div>
                                        <?php else: ?>
                                            <div class="inline-flex items-center gap-1.5 px-3 py-1 bg-rose-50 text-rose-600 rounded-lg border border-rose-100">
                                                <i class="fas fa-minus-circle text-[10px]"></i>
                                                <span class="font-black text-sm"><?php echo e($log->quantity); ?></span>
                                            </div>
                                        <?php endif; ?>
                                    </td>
                                    <td class="px-4 py-5 text-center bg-[#fef3c7]/10">
                                        <span class="text-base font-black text-[#2c1a0e]"><?php echo e($stokSesudah); ?></span>
                                    </td>
                                    <td class="px-6 py-5">
                                        <p class="text-xs text-[#8c6a4a] font-medium leading-relaxed max-w-[200px] break-words">
                                            <?php echo e($log->note ?? '-'); ?>

                                        </p>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td colspan="6" class="py-24 text-center">
                                        <div class="flex flex-col items-center">
                                            <div class="w-16 h-16 bg-[#fef9f0] rounded-full flex items-center justify-center mb-4">
                                                <i class="fas fa-box-open text-2xl text-[#e0d3c2]"></i>
                                            </div>
                                            <span class="text-[#8c6a4a] font-bold">Tidak ada riwayat stok</span>
                                            <span class="text-xs text-[#c9b59b]">Coba ubah filter atau pencarian Anda</span>
                                        </div>
                                    </td>
                                </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>

            
            <div class="mt-10">
                <?php echo e($logs->links()); ?>

            </div>
        </div>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?><?php /**PATH C:\laragon\www\LokaPustaka\resources\views/stock-logs/index.blade.php ENDPATH**/ ?>