<style>
    .contain {
        display: flex;
        justify-content: center;
        align-items: center;
        object-fit: contain;
    }

    .contain img {
        width: 238px;
        height: 159px;
    }

    .mb-10 {
        margin-bottom: 2em;
    }
</style>

<!--Main layout-->
<div class="my-5 bg-white py-4">
    <div class="container">
        <div class="row g-4">

            <?php foreach ($galleryDetails as $listing): { ?>

                    <div class="col-xs-12 col-sm-12 col-md-3 col-xl-3 col-xxl-3 mb-5 mb-lg-0">

                        <!-- Content Image -->
                        <div class="contain h-75">
                            <?= $this->Html->image(Cake\Core\Configure::read('IMAGE_PREPATH', '') . $listing->image_path, ['id' => 'image', 'class' => 'img-fluid h-75']) ?>
                        </div>

                        <!-- Content title -->
                        <div class="text-center ">
                            <h4 class='fw-bold'>
                                <?= $listing->name ?>
                            </h4>
                        </div>

                        <!-- Contents Button -->
                        <div class="text-center mb-10">
                            <?php

                            if (in_array($listing->status, [0, 2, 99])) {
                                echo $this->Html->link(__('Enable '), ['controller' => 'Gallery', 'action' => 'enable', $listing->id], ['class' => 'btn btn-info']);
                            } else if ($listing->status == 1) {
                                echo $this->Html->link(__('Disable '), ['controller' => 'Gallery', 'action' => 'disable', $listing->id], ['class' => 'btn btn-danger']);
                            }
                            echo " ";
                            echo $this->Html->link(__("Remove"), ['controller' => 'Gallery', 'action' => 'remove', $listing->id], ['class' => 'btn btn-primary']);
                            ?>
                        </div>

                    </div>

                <?php }endforeach ?>
        </div>
        <!-- </?php echo $this->element('pagination/pagination'); ?> -->
    </div>
</div>