<ul class="breadcrumb">
    <li><a href="<?= site_url('admin/dashboard') ?>">Home</a></li>
    <li class="active"><?php echo $breadcum ?></li> 
</ul>
<div class="page-content-wrap">                
                  <div class="row">
                        <div class="col-md-12">
                            <div class="panel panel-default">
                                    <?php if ($this->session->flashdata('NewsSuccess')) { ?>  
                                    <div class="alert alert-success"> <?= $this->session->flashdata('NewsSuccess') ?></div>
                                <?php } ?>
                                <div class="panel-heading">
                                    <h3 class="panel-title">Manage Banner</h3>
                                    <ul class="panel-controls" style="margin-top: 2px;">                                     
                                        <li class="dropdown">
                                            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="fa fa-cog"></span></a>                                        
                                            <ul class="dropdown-menu">
                                                <li><a href="<?= base_url()?>admin/newsletter-add"><span class="fa fa-plus-square"></span>Add New</a></li>
                                            </ul>                                        
                                        </li>                                        
                                    </ul>
                                </div>
                                <div class="panel-body panel-body-table">
                                    <div class="table-responsive">
                                        <table class="table datatable">
                                            <thead>
                                                <tr>
                                                    <th>Newsletter Title</th>
                                                    <th>Status</th>
                                                    <th>actions</th>
                                                </tr>
                                            </thead>
                                            <tbody>   
                                                 <?php                                              
                                                    foreach ($news_data as $news) {
                                                        ?>
                                                <tr id="trow_<?= $key ?>">
                                                    <td><strong><?php echo (isset($news['newsletter_title'])) ? $news['newsletter_title'] : '-'; ?></strong></td>
                                                    <td><?php echo (isset($news['status'])) && $news['status'] == 'active' ? "<span class='label label-success'>Active" : "<span class='label label-danger'>Inactive"; ?></td>
                                                    <td>
                                            <?php echo anchor(base_url() . 'admin/newsletter-edit/' . $news['newsletter_id'], '<span class="fa fa-pencil" title="Edit"></span>', 'class="btn btn-default btn-rounded btn-condensed btn-sm"'); ?>   
                                                      
                                                        <a data-height="800" style="float: contour;" data-width="790" class="fancybox fancybox.iframe btn btn-default btn-rounded btn-condensed btn-sm" href="<?= base_url() . 'admin/newsletter-view/'.$news['newsletter_id'] ;?>"><span class="fa fa-eye" title="view"></span></a>                                                        
                                        
                                                <?php if ($news['status'] == 'active') { ?>
                                                        <a href="javascript:" data-href="<?= base_url() . 'admin/newsletter-status/' . $news['newsletter_id'] . '/inactive' ?>" class="btn btn-default btn-rounded btn-condensed btn-sm changestatus"><span class="fa fa-ban" title="Inactive"></span></a>
                                                <?php } else { ?>    
                                                    <a href="javascript:" data-href="<?= base_url() . 'admin/newsletter-status/' . $news['newsletter_id'] . '/active' ?>" class="btn btn-default btn-rounded btn-condensed btn-sm changestatus"><span class="fa fa-check-circle-o" title="Active"></span></a>
                                                <?php } ?>
                                                <a href="javascript:" data-href="<?= base_url() . 'admin/newsletter-delete/' . $news['newsletter_id'] ?>" class="btn btn-danger btn-rounded btn-condensed btn-sm delete"><span class="fa fa-times" title="delete"></span></a>
                                                
                                                <a href="javascript:" data-href="<?= base_url() . 'admin/newsletter-send/' . $news['newsletter_id'] ?>" class="btn btn-default btn-rounded btn-condensed btn-sm sendnewsletter"><span class="fa fa-file-text" title="Send NewsLetter"></span></a>
                                         
                                        </td> 
                                    </tr>    
<?php } ?>   
                                            </tbody>
                                        </table>
                                    </div>                                

                                </div>
                            </div>                                                

                        </div>
                    </div>
</div>
<script>  
    
     $('body').delegate('.sendnewsletter', 'click', function(evt) {   
	  var hrefUrl = $(this).attr('data-href'); 
       var box = $("#mb-sendnews-row");
        box.addClass("open");
        box.find(".mb-control-yes").on("click",function(){
            box.removeClass("open");
             window.location.href = hrefUrl;
        });
    });   
    
</script>
             
                        