<?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">
            <h2 class="font-semibold text-xl text-gray-800 leading-tight">
                <?php echo e(__('My Drafts')); ?>

            </h2>
            <a href="<?php echo e(route('my-items.create')); ?>" class="inline-flex items-center px-4 py-2 bg-blue-600 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-blue-700 transition ease-in-out duration-150">
                Create New Item
            </a>
        </div>
     <?php $__env->endSlot(); ?>

    <div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            <?php if(session('success')): ?>
                <div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-6" 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; ?>
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="p-6">
                    <?php if($items->count() > 0): ?>
                        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
                            <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="group border rounded-lg overflow-hidden">
                                    <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; ?>
                                        
                                        <!-- Draft Badge -->
                                        <div class="absolute top-2 left-2 bg-yellow-500 text-white text-xs px-2 py-1 rounded">
                                            Draft
                                        </div>
                                        
                                        <!-- Listing Type Badge -->
                                        <?php if($item->listing_type): ?>
                                            <div class="absolute top-2 right-2 bg-gray-500 text-white text-xs px-2 py-1 rounded">
                                                <?php echo e(ucfirst(str_replace('_', ' ', $item->listing_type))); ?>

                                            </div>
                                        <?php endif; ?>
                                    </div>
                                    
                                    <div class="p-4">
                                        <h3 class="font-semibold text-gray-900 group-hover:text-blue-600 line-clamp-2">
                                            <?php echo e($item->title ?: 'Untitled Draft'); ?>

                                        </h3>
                                        <?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)); ?></p>
                                        <?php elseif($item->listing_type === 'inventory'): ?>
                                            <p class="font-bold text-lg text-green-600">Personal Inventory</p>
                                        <?php else: ?>
                                            <p class="font-bold text-lg text-gray-500">No Price Set</p>
                                        <?php endif; ?>
                                        
                                        <div class="mt-4 space-y-2">
                                            <div class="flex space-x-2">
                                                <a href="<?php echo e(route('my-items.edit', $item)); ?>" class="flex-1 text-center px-3 py-2 bg-blue-600 text-white text-sm rounded hover:bg-blue-700">
                                                    Edit
                                                </a>
                                                <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-2 bg-red-600 text-white text-sm rounded hover:bg-red-700">
                                                        Delete
                                                    </button>
                                                </form>
                                            </div>
                                            <?php if($item->title && $item->description && $item->condition && $item->listing_type && $item->photos->count() > 0): ?>
                                                <form method="POST" action="<?php echo e(route('items.publish', $item)); ?>" class="w-full">
                                                    <?php echo csrf_field(); ?>
                                                    <button type="submit" class="w-full px-3 py-2 bg-green-600 text-white text-sm rounded hover:bg-green-700">
                                                        Publish
                                                    </button>
                                                </form>
                                            <?php else: ?>
                                                <div class="w-full px-3 py-2 bg-gray-300 text-gray-500 text-sm rounded text-center">
                                                    Complete to Publish
                                                </div>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>

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

                        </div>
                    <?php else: ?>
                        <div class="text-center py-12">
                            <div class="inline-flex items-center justify-center w-16 h-16 bg-gray-100 rounded-full mb-4">
                                <svg class="w-8 h-8 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
                                </svg>
                            </div>
                            <h3 class="text-lg font-medium text-gray-900 mb-2">No drafts yet</h3>
                            <p class="text-gray-500 mb-4">Save items as drafts while you work on them.</p>
                            <a href="<?php echo e(route('my-items.create')); ?>" class="inline-flex items-center px-4 py-2 bg-blue-600 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-blue-700 transition ease-in-out duration-150">
                                Create Your First Item
                            </a>
                        </div>
                    <?php endif; ?>
                </div>
            </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 /var/www/html/resources/views/items/my-drafts.blade.php ENDPATH**/ ?>