<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve(['title' => 'Buy & Sell Musical Instruments','description' => 'Browse ' . $items->total() . ' musical instruments and gear for sale.'] + (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([]); ?>
    <div class="py-8">
        <div class="max-w-3xl mx-auto px-4">
            <!-- Intro + search -->
            <div class="mb-8">
                <h1 class="text-lg font-semibold text-black dark:text-gray-100 mb-1">Gear for sale</h1>
                <p class="text-sm text-gray-500 dark:text-gray-400 mb-4"><?php echo e($items->total()); ?> <?php echo e(Str::plural('item', $items->total())); ?> listed by people like you.</p>

                <form method="GET" class="flex flex-wrap items-center gap-2 text-sm">
                    <input type="text" name="search" value="<?php echo e(request('search')); ?>" placeholder="search"
                        class="flex-1 min-w-40 px-2 py-1 border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-black dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:border-black dark:focus:border-gray-300">

                    <select name="category" class="px-2 py-1 border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-black dark:text-gray-100">
                        <option value="">all categories</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') == $category->id ? 'selected' : ''); ?>>
                                <?php echo e(strtolower($category->name)); ?>

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

                    <select name="sort" class="px-2 py-1 border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-black dark:text-gray-100">
                        <option value="newest" <?php echo e(request('sort') == 'newest' ? 'selected' : ''); ?>>newest</option>
                        <option value="oldest" <?php echo e(request('sort') == 'oldest' ? 'selected' : ''); ?>>oldest</option>
                        <option value="price_low" <?php echo e(request('sort') == 'price_low' ? 'selected' : ''); ?>>price: low</option>
                        <option value="price_high" <?php echo e(request('sort') == 'price_high' ? 'selected' : ''); ?>>price: high</option>
                    </select>

                    <button type="submit" class="px-3 py-1 border border-gray-400 dark:border-gray-500 rounded text-black dark:text-gray-100 hover:bg-gray-100 dark:hover:bg-gray-800">go</button>

                    <?php if(request()->hasAny(['search', 'category', 'sort', 'type', 'min_price', 'max_price', 'location'])): ?>
                        <a href="<?php echo e(route('items.index')); ?>" class="text-gray-500 dark:text-gray-400 hover:underline">clear</a>
                    <?php endif; ?>
                </form>
            </div>

            <!-- Item rows -->
            <?php if($items->count() > 0): ?>
                <ul class="divide-y divide-gray-200 dark:divide-gray-700 border-t border-b border-gray-200 dark:border-gray-700 mb-8">
                    <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <li class="py-3">
                            <div class="flex items-baseline justify-between gap-4">
                                <a href="<?php echo e(route('items.show', $item)); ?>" data-item-id="<?php echo e($item->id); ?>" class="text-black dark:text-gray-100 font-medium hover:underline">
                                    <?php echo e($item->title); ?>

                                </a>
                                <span class="text-black dark:text-gray-100 whitespace-nowrap">
                                    <?php if($item->price && in_array($item->listing_type, ['sale', 'inventory_open'])): ?>
                                        $<?php echo e(number_format($item->price, 0)); ?>

                                    <?php elseif($item->listing_type === 'trade'): ?>
                                        trade
                                    <?php else: ?>
                                        inventory
                                    <?php endif; ?>
                                </span>
                            </div>
                            <p class="text-xs text-gray-500 dark:text-gray-400 mt-1">
                                <?php if($item->category): ?><?php echo e(strtolower($item->category->name)); ?><?php endif; ?>
                                <?php if($item->location_city || $item->location_state): ?>
                                    &middot; <?php echo e(collect([$item->location_city, $item->location_state])->filter()->join(', ')); ?>

                                <?php endif; ?>
                                &middot; <a href="<?php echo e(route('sellers.profile', $item->user)); ?>" class="hover:underline"><?php echo e($item->user->name); ?></a>
                                &middot; <?php echo e($item->created_at->diffForHumans()); ?>

                                <?php if(($item->quantity ?? 1) > 1): ?>
                                    &middot; qty <?php echo e($item->quantity); ?>

                                <?php endif; ?>
                                <?php if($item->status === 'sale_pending'): ?>
                                    &middot; <span class="text-amber-600 dark:text-amber-400">sale pending</span>
                                <?php endif; ?>
                            </p>
                        </li>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </ul>

                <div class="mb-8">
                    <?php echo e($items->links()); ?>

                </div>
            <?php else: ?>
                <div class="py-16 text-center">
                    <p class="text-sm text-gray-500 dark:text-gray-400 mb-4">nothing found</p>
                    <a href="<?php echo e(route('items.index')); ?>" class="text-sm text-black dark:text-gray-100 hover:underline">see all</a>
                </div>
            <?php endif; ?>

            <p class="text-xs text-gray-400 dark:text-gray-500">
                prefer pictures? <a href="<?php echo e(request()->fullUrlWithQuery(['ui' => 'classic'])); ?>" class="underline">switch to the photo view</a>
            </p>
        </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 /var/www/html/resources/views/simple/items/index.blade.php ENDPATH**/ ?>