<div class="page-title">
    <div class="container">
        <div class="banner-full-wrap">
            <div class="row g-0">
                <div class="col-md-4">
                    <div class="text-center banner-right-wrap">
                        <h1 class="main-title">Recipes</h1>
                    </div>
                </div>
                <div class="col-md-8">
                    <img src="<?php echo base_url(); ?>assets/user/img/recipies.webp" alt="shop" class="w-100">
                </div>
            </div>
        </div>
    </div>
</div>
<?php $category = $this->common->getData('recipe_category',array(),array(),array('field'=>'item_order','by'=>'asc')); 
    if(isset($_GET['catid']) && $_GET['catid']!=''){
        $cname = $this->common->getsData('recipe_category',array('id'=>$_GET['catid']),'category');
        $select_cat = (isset($cname['category']))?$cname['category']:'';
    }else{
        $select_cat = 'All';
    }
?>

<div class="home2 news-section">
    <div class="container">
        <div class="row g-md-3 g-3 justify-content-center">
            <div class="col-lg-3 col-md-3 col-12">
                <div class="d-flex justify-content-end pb-md-5 pb-4">
                    <div class="filter-wrap">
                        <div class="dropdown">
                            <button class="dropdown-toggle w-100" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                            <?php echo $select_cat; ?>
                            </button>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo base_url(); ?>recipes" class="dropdown-item <?php echo(!isset($_GET['catid']))?'active':''; ?>">All</a></li>
                                <?php if(isset($category) && $category){ foreach ($category as $key => $value){ ?>
                                    <li><a href="<?php echo base_url('recipes?catid='.$value['id']); ?>" class="dropdown-item"><?php echo $value['category']; ?></a></li>
                                <?php } } ?>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row gx-md-4 gy-md-5 g-3">
            <?php if(isset($recipes) && $recipes){ foreach ($recipes as $key => $value){ ?>
                <div class="col-lg-4 col-md-4 col-sm-4 col-12">
                    <div class="our-news">
                        <div class="img-wrap">
                            <?php if($value['image']!=''){ ?>
                                <img src="<?php echo base_url($value['image']); ?>" class="img-fluid" alt="recipe image">
                            <?php }else{ ?>
                                <img src="<?php echo base_url(); ?>assets/user/img/news.webp" class="img-fluid" alt="recipe image">
                            <?php } ?>
                        </div>
                        <div class="content-wrap">
                            <h1 style="min-height:48px; color:#353535 !important;"><?php echo substr($value['title'],0,40); ?> <?php echo(strlen($value['title'])>40)?'...':''; ?></h1>
                            <a href="<?php echo base_url('recipe-detail/'.url_title(strtolower($value['title'])).'/'.$value['id']); ?>" class="btn btn-primary"> <span> View More <div><img src="<?php echo base_url(); ?>assets/user/img/btn-right.png" class="img" alt="right"> </div> </span></a>
                        </div>
                    </div>
                </div>
            <?php } } ?>
            <div class="text-center">
                <nav aria-label="Page navigation example">
                    <!-- <ul class="pagination justify-content-center mt-md-5 mt-4 mb-4">
                        <li class="page-item"><a class="page-link active" href="#">1</a></li>
                        <li class="page-item"><a class="page-link" href="#">2</a></li>
                        <li class="page-item"><a class="page-link" href="#">3</a></li>
                        <li class="page-item"><a class="page-link" href="#">4</a></li>
                    </ul> -->
                    <?php echo $this->pagination->create_links(); ?>
                </nav>
            </div>
        </div>
    </div>
</div>

<?php $this->load->view('contact-section'); ?>