
<div class="breadcrumbs">
    <div class="breadcrumbs-inner">
        <?php
        if($this->session->flashdata('message')) {
        $message = $this->session->flashdata('message');
        ?>
            <div class="alert alert-<?php echo $message['class']; ?>">
                <button class="close" data-dismiss="alert" type="button">×</button>
                <?php echo $message['message']; ?>
            </div>
        <?php
        }
        ?>
        <div class="row m-0">
            <div class="col-sm-4">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><?= $pTitle ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-8">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li><a href="<?= base_url() ?>">Dashboard</a></li>
                            <li><a ><?= $menu ?></a></li>
                           <!--  <li class="active"><?= $smenu ?></li> -->
                        </ol>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- PAGE-INDEX-ENDS -->

<!-- PAGE-CONTENT-STARTS -->

<div class="content">
    <div class="animated fadeIn">
        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <div class="card-header">
                         <strong class="card-title"> <?= $smenu ?></strong>
                    </div>
                    <div class="card-body">
                        <table id="bootstrap-data-table" class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    <th>No</th>
                                    <th>Title</th>
                                    <th>Ads Image</th>
                                    
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                if(!empty($adsData)){
                                foreach($adsData as $key =>  $ads) { ?> 
                                <tr>
                                    <td><?php echo $key+1;?></td>
                                    <td><?= $ads->agent_code ?></td>
                                    <td><?= $ads->name ?></td>
                                    <td><?= $ads->phone_no ?></td>
                                   
                                    <td>
                                        <a class="btn btn-info btn-sm" href="<?= base_url('Ads/edit/'.encode_param($ads->id))?>">
                                            <i class="fa fa-fw fa-pencil"></i>
                                               Edit
                                        </a>
                                        <a class="btn btn-danger btn-sm" href="<?= base_url("Ads/changeStatus/".encode_param($ads->id))."/2" ?>"
                                            onClick="return doconfirm()">
                                            <i class="fa fa-fw fa-trash"></i>Delete
                                        </a>
                                         <?php if($ads->status == 1){ ?>
                                          <a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Ads/changeStatus/".encode_param($ads->id))."/0" ?>">
                                            <i class="fa fa-cog"></i> De-activate
                                          </a>
                                        <?php } if($ads->status == 0) { ?>
                                          <a class="btn btn-sm btn-success" href="<?= base_url("Ads/changeStatus/".encode_param($ads->id))."/1" ?>">
                                            <i class="fa fa-cog"></i> Activate
                                          </a>
                                        <?php } ?>
                                    </td>
                                </tr>
                                <?php }} ?> 
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- PAGE-CONTENT-ENDS -->
<script type="text/javascript">        
        function doconfirm(){
        action = confirm("Are you sure to delete permanently?");
        if(action != true) return false;
        }
    </script>