<?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([]); ?>
     <?php $__env->slot('header', null, []); ?> 
        <div class="flex justify-between items-center">
            <div class="flex items-center space-x-4">
                <h2 class="font-semibold text-xl text-gray-800 leading-tight">
                    <?php echo e(__('My Listings')); ?>

                </h2>
                <?php if(auth()->user()->isOnVacation()): ?>
                    <span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-gray-100 text-gray-700">
                        <svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path>
                        </svg>
                        On Vacation
                    </span>
                <?php endif; ?>
            </div>
            <div class="flex space-x-3">
                <?php if (isset($component)) { $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.secondary-button','data' => ['onclick' => 'window.location=\''.e(route('items.mass-listing')).'\'']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('secondary-button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['onclick' => 'window.location=\''.e(route('items.mass-listing')).'\'']); ?>
                    Bulk Import
                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $attributes = $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $component = $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
                <?php if (isset($component)) { $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.secondary-button','data' => ['onclick' => 'window.location=\''.e(route('my-items.create')).'\'']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('secondary-button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['onclick' => 'window.location=\''.e(route('my-items.create')).'\'']); ?>
                    List New Item
                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $attributes = $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $component = $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
            </div>
        </div>
     <?php $__env->endSlot(); ?>

    <div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-8">
            <?php if(session('success')): ?>
                <div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded" id="success-message">
                    <div class="flex items-center">
                        <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
                            <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path>
                        </svg>
                        <?php echo e(session('success')); ?>

                    </div>
                </div>
            <?php endif; ?>

            <!-- Vacation Mode Alert -->
            <?php if(auth()->user()->isOnVacation()): ?>
                <div class="bg-gray-50 border border-gray-200 rounded-lg p-4">
                    <div class="flex items-center">
                        <svg class="w-5 h-5 text-gray-600 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path>
                        </svg>
                        <h4 class="text-gray-700 font-semibold">Vacation Mode Active</h4>
                    </div>
                    <div class="mt-2 text-gray-600 text-sm">
                        <p>Your listings are still visible, but buyers will see that you're on vacation and unable to ship items.</p>
                        <?php if(auth()->user()->vacation_message): ?>
                            <p class="mt-2 font-medium">"<?php echo e(auth()->user()->vacation_message); ?>"</p>
                        <?php endif; ?>
                        <p class="mt-2">
                            <a href="<?php echo e(route('profile.edit')); ?>" class="text-gray-700 underline hover:no-underline">
                                Manage vacation mode settings →
                            </a>
                        </p>
                    </div>
                </div>
            <?php endif; ?>
            
            <!-- Live Listings Section -->
            <?php if($liveItems->count() > 0): ?>
                <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                    <div class="p-6">
                        <h3 class="text-lg font-semibold text-gray-900 mb-4">Live Listings (<?php echo e($liveItems->count()); ?>)</h3>
                        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
                            <!-- Create New Listing Tile -->
                            <a href="<?php echo e(route('my-items.create')); ?>" class="group border-2 border-dashed border-gray-300 rounded-lg overflow-hidden hover:border-gray-400 transition-colors">
                                <div class="aspect-square bg-gradient-to-br from-gray-50 to-gray-100 flex items-center justify-center hover:from-gray-100 hover:to-gray-200 transition-colors">
                                    <div class="text-center">
                                        <svg class="w-12 h-12 text-gray-500 mx-auto mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
                                        </svg>
                                        <span class="text-gray-700 font-semibold text-sm">Create New Listing</span>
                                    </div>
                                </div>
                            </a>

                            <?php $__currentLoopData = $liveItems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="group border rounded-lg overflow-hidden">
                                    <a href="<?php echo e(route('items.show', $item)); ?>" class="block">
                                        <div class="aspect-square bg-gray-200 overflow-hidden relative">
                                            <?php if($item->primaryPhoto): ?>
                                                <img src="<?php echo e(asset($item->primaryPhoto->url)); ?>" alt="<?php echo e($item->title); ?>" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-200">
                                            <?php else: ?>
                                                <div class="w-full h-full flex items-center justify-center">
                                                    <span class="text-gray-400">No Image</span>
                                                </div>
                                            <?php endif; ?>
                                            
                                            <!-- Status Badge -->
                                            <?php if($item->status === 'sale_pending'): ?>
                                                <div class="absolute top-2 left-2 bg-orange-500 text-white text-xs px-2 py-1 rounded">
                                                    Sale Pending
                                                </div>
                                            <?php elseif($item->status === 'removed'): ?>
                                                <div class="absolute top-2 left-2 bg-red-600 text-white text-xs px-2 py-1 rounded">
                                                    Removed by admin
                                                </div>
                                            <?php endif; ?>
                                            
                                            <!-- Interested Buyers -->
                                            <?php if($item->buyQueue && $item->buyQueue->count() > 0): ?>
                                                <div class="absolute bottom-2 left-2 bg-green-500 text-white text-xs px-2 py-1 rounded">
                                                    <?php echo e($item->buyQueue->count()); ?> interested
                                                </div>
                                            <?php endif; ?>
                                        </div>
                                    </a>
                                    
                                    <div class="p-4">
                                        <h3 class="font-semibold text-gray-900 group-hover:opacity-60 transition-opacity line-clamp-2 mb-1"><?php echo e($item->title); ?></h3>
                                        <?php if($item->category): ?>
                                            <p class="text-sm text-gray-600 mb-1"><?php echo e($item->category->name); ?></p>
                                        <?php endif; ?>
                                        
                                        <?php if($item->price && in_array($item->listing_type, ['sale', 'inventory_open'])): ?>
                                            <p class="font-bold text-lg text-gray-900">$<?php echo e(number_format($item->price, 2)); ?><?php if(($item->quantity ?? 1) > 1): ?> <span class="text-sm font-normal text-gray-600">(qty <?php echo e($item->quantity); ?>)</span><?php endif; ?></p>
                                        <?php else: ?>
                                            <p class="font-bold text-lg text-gray-900">
                                                <?php if($item->listing_type === 'trade'): ?>
                                                    Trade Only
                                                <?php else: ?>
                                                    Inventory
                                                <?php endif; ?>
                                                <?php if(($item->quantity ?? 1) > 1): ?> <span class="text-sm font-normal text-gray-600">(qty <?php echo e($item->quantity); ?>)</span><?php endif; ?>
                                            </p>
                                        <?php endif; ?>
                                        
                                        <?php if($item->status === 'removed' && $item->admin_note): ?>
                                            <p class="text-xs text-red-600 mt-1"><?php echo e($item->admin_note); ?></p>
                                        <?php endif; ?>

                                        <div class="flex items-center justify-between text-xs text-gray-500 mt-2">
                                            <span><?php echo e($item->views); ?> views</span>
                                            <span><?php echo e($item->created_at->diffForHumans()); ?></span>
                                        </div>

                                        <!-- Action Buttons -->
                                        <div class="mt-3 flex space-x-2 text-xs">
                                            <a href="<?php echo e(route('my-items.edit', $item)); ?>" class="flex-1 text-center px-3 py-1 bg-white border border-gray-300 text-gray-700 font-medium rounded hover:bg-gray-50 transition">
                                                Edit
                                            </a>
                                            <?php if($item->buyQueue && $item->buyQueue->count() > 0): ?>
                                                <a href="<?php echo e(route('items.manage-queue', $item)); ?>" class="flex-1 text-center px-3 py-1 bg-white border border-gray-300 text-gray-700 font-medium rounded hover:bg-gray-50 transition">
                                                    Queue (<?php echo e($item->buyQueue->count()); ?>)
                                                </a>
                                            <?php endif; ?>
                                            <form method="POST" action="<?php echo e(route('my-items.destroy', $item)); ?>" class="flex-1" onsubmit="return confirm('Are you sure you want to delete this item?')">
                                                <?php echo csrf_field(); ?>
                                                <?php echo method_field('DELETE'); ?>
                                                <button type="submit" class="w-full px-3 py-1 bg-white border border-red-300 text-red-600 font-medium rounded hover:bg-red-50 transition">
                                                    Delete
                                                </button>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    </div>
                </div>
            <?php endif; ?>

            <!-- Drafts Section -->
            <?php if($draftItems->count() > 0): ?>
                <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                    <div class="p-6">
                        <h3 class="text-lg font-semibold text-gray-900 mb-4">Drafts (<?php echo e($draftItems->count()); ?>)</h3>
                        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
                            <?php $__currentLoopData = $draftItems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="group border rounded-lg overflow-hidden bg-gray-50">
                                    <div class="aspect-square bg-gray-200 overflow-hidden relative">
                                        <?php if($item->primaryPhoto): ?>
                                            <img src="<?php echo e(asset($item->primaryPhoto->url)); ?>" alt="<?php echo e($item->title); ?>" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-200 opacity-75">
                                        <?php else: ?>
                                            <div class="w-full h-full flex items-center justify-center">
                                                <span class="text-gray-400">No Image</span>
                                            </div>
                                        <?php endif; ?>
                                        
                                        <!-- Draft Badge -->
                                        <div class="absolute top-2 right-2 bg-white border border-gray-300 text-gray-700 text-xs px-2 py-1 rounded font-medium">
                                            Draft
                                        </div>
                                    </div>
                                    
                                    <div class="p-4">
                                        <h3 class="font-semibold text-gray-700 line-clamp-2 mb-1"><?php echo e($item->title ?: 'Untitled Draft'); ?></h3>
                                        <?php if($item->category): ?>
                                            <p class="text-sm text-gray-500 mb-1"><?php echo e($item->category->name); ?></p>
                                        <?php endif; ?>
                                        
                                        <?php if($item->price && in_array($item->listing_type, ['sale', 'inventory_open'])): ?>
                                            <p class="font-bold text-lg text-gray-700">$<?php echo e(number_format($item->price, 2)); ?><?php if(($item->quantity ?? 1) > 1): ?> <span class="text-sm font-normal text-gray-500">(qty <?php echo e($item->quantity); ?>)</span><?php endif; ?></p>
                                        <?php else: ?>
                                            <p class="font-bold text-lg text-gray-600">
                                                <?php if($item->listing_type === 'trade'): ?>
                                                    Trade Only
                                                <?php elseif($item->listing_type === 'inventory_open'): ?>
                                                    Inventory + Offers
                                                <?php else: ?>
                                                    Inventory
                                                <?php endif; ?>
                                                <?php if(($item->quantity ?? 1) > 1): ?> <span class="text-sm font-normal text-gray-500">(qty <?php echo e($item->quantity); ?>)</span><?php endif; ?>
                                            </p>
                                        <?php endif; ?>
                                        
                                        <div class="text-xs text-gray-400 mt-2">
                                            <span>Created <?php echo e($item->created_at->diffForHumans()); ?></span>
                                        </div>
                                        
                                        <!-- Action Buttons for Drafts -->
                                        <div class="mt-3 flex space-x-2 text-xs">
                                            <a href="<?php echo e(route('my-items.edit', $item)); ?>" class="flex-1 text-center px-3 py-1 bg-white border border-gray-300 text-gray-700 font-medium rounded hover:bg-gray-50 transition">
                                                Edit
                                            </a>
                                            <form method="POST" action="<?php echo e(route('items.publish', $item)); ?>" class="flex-1">
                                                <?php echo csrf_field(); ?>
                                                <button type="submit" class="w-full px-3 py-1 bg-white border border-gray-300 text-gray-700 font-medium rounded hover:bg-gray-50 transition">
                                                    Publish
                                                </button>
                                            </form>
                                            <form method="POST" action="<?php echo e(route('my-items.destroy', $item)); ?>" class="flex-1" onsubmit="return confirm('Are you sure you want to delete this draft?')">
                                                <?php echo csrf_field(); ?>
                                                <?php echo method_field('DELETE'); ?>
                                                <button type="submit" class="w-full px-3 py-1 bg-white border border-red-300 text-red-600 font-medium rounded hover:bg-red-50 transition">
                                                    Delete
                                                </button>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    </div>
                </div>
            <?php endif; ?>

            <!-- Empty State -->
            <?php if($liveItems->count() === 0 && $draftItems->count() === 0): ?>
                <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                    <div class="p-6">
                        <div class="text-center py-12">
                            <h3 class="text-lg font-semibold text-gray-900 mb-2">No items listed yet</h3>
                            <p class="text-gray-600 mb-6">List your first instrument to start selling or trading!</p>
                            <div class="flex justify-center space-x-3">
                                <?php if (isset($component)) { $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.secondary-button','data' => ['onclick' => 'window.location=\''.e(route('items.mass-listing')).'\'']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('secondary-button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['onclick' => 'window.location=\''.e(route('items.mass-listing')).'\'']); ?>
                                    Bulk Import
                                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $attributes = $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $component = $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
                                <?php if (isset($component)) { $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.secondary-button','data' => ['onclick' => 'window.location=\''.e(route('my-items.create')).'\'']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('secondary-button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['onclick' => 'window.location=\''.e(route('my-items.create')).'\'']); ?>
                                    List Your First Item
                                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $attributes = $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $component = $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            <?php endif; ?>
        </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/items/my-listings.blade.php ENDPATH**/ ?>