

<?php $__env->startSection('content'); ?>
    <div class="container-xxl flex-grow-1 container-p-y">
        <div class="card">
            <div class="card-header">
                <div class="row align-items-center">
                    <div class="col-8">
                        <h5 class="card-title mb-0">
                            Product Images: <span class="text-primary"><?php echo e($product->name); ?></span>
                        </h5>
                    </div>
                    
                    <div class="col-4 text-end">
                        <a href="<?php echo e(route('products.index')); ?>" class="btn btn-secondary me-2">
                            <i class="fas fa-arrow-left me-2"></i>Back to Products
                        </a>
                       
                    </div>
                </div>
                <hr />
            </div>

            <div class="card-body">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session('success')): ?>
                    <div class="alert alert-success alert-dismissible fade show" role="alert">
                        <?php echo e(session('success')); ?>

                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($images->isEmpty()): ?>
                    <div class="text-center py-5">
                        <i class="fas fa-image fa-4x text-muted mb-3"></i>
                        <h5>No images found for this product</h5>
                        <p class="text-muted">Upload images to showcase this product</p>
                        <a href="<?php echo e(route('products.images.create', $product->id)); ?>" class="btn btn-primary mt-2">
                            <i class="fas fa-upload me-2"></i>Upload Images
                        </a>
                    </div>
                <?php else: ?>
                    <div class="row">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $images; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $image): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="col-md-3 col-sm-4 col-6 mb-4">
                                <div class="card">
                                    <div class="position-relative">
                                        <img src="<?php echo e($image->thumbnail_url); ?>" 
                                             alt="Product Image" 
                                             class="card-img-top" 
                                             style="height: 200px; object-fit: cover;">
                                        <div class="position-absolute top-0 end-0 p-2">
                                            <span class="badge bg-secondary">#<?php echo e($loop->iteration); ?></span>
                                        </div>
                                    </div>
                                    <div class="card-body text-center">
                                        <small class="text-muted d-block mb-2">
                                            <?php echo e($image->created_at->format('M d, Y')); ?>

                                        </small>
                                        <div class="btn-group" role="group">
                                            <a href="<?php echo e($image->image_url); ?>" 
                                               target="_blank" 
                                               class="btn btn-sm btn-info" 
                                               title="View Original">
                                                <i class="fas fa-expand"></i>
                                            </a>
                                            <a href="<?php echo e(route('products.images.show', [$product->id, $image->id])); ?>" 
                                               class="btn btn-sm btn-primary" 
                                               title="View Details">
                                                <i class="fas fa-eye"></i>
                                            </a>
                                            <form action="<?php echo e(route('products.images.destroy', [$product->id, $image->id])); ?>" 
                                                  method="POST" 
                                                  class="d-inline"
                                                  onsubmit="return confirm('Are you sure you want to delete this image?');">
                                                <?php echo csrf_field(); ?>
                                                <?php echo method_field('DELETE'); ?>
                                                <button type="submit" class="btn btn-sm btn-danger" title="Delete">
                                                    <i class="fas fa-trash"></i>
                                                </button>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>

                    <div class="mt-3">
                        <div class="alert alert-info">
                            <i class="fas fa-info-circle me-2"></i>
                            Total <?php echo e($images->count()); ?> images for this product
                        </div>

                        <div class="">
                         <a href="<?php echo e(route('products.images.create', $product->id)); ?>" class="btn btn-primary">
                            <i class="fas fa-plus me-2"></i>Upload Images
                        </a>
                    </div>
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH F:\xampp\htdocs\G_desizn\mfmsqatar\resources\views/product-images/index.blade.php ENDPATH**/ ?>